chore: reverse connect array to ensure relations are connected before positioning

This commit is contained in:
Josh 2022-11-15 14:16:20 +00:00
parent e241d0ce37
commit 1bde22fdd9
2 changed files with 8 additions and 8 deletions

View File

@ -125,7 +125,7 @@ const cleanData = ({ browserState, serverState }, currentSchema, componentsSchem
cleanedData = {
disconnect: disconnectedRelations,
connect: connectedRelations,
connect: connectedRelations.reverse(),
};
break;

View File

@ -826,8 +826,8 @@ describe('CM || components || EditViewDataManagerProvider || utils || cleanData'
expect(result).toStrictEqual({
relation: {
connect: [
{ id: 1, position: { before: 2 } },
{ id: 2, position: { end: true } },
{ id: 1, position: { before: 2 } },
],
disconnect: [],
},
@ -851,12 +851,12 @@ describe('CM || components || EditViewDataManagerProvider || utils || cleanData'
expect(result).toStrictEqual({
relation: {
connect: [
{ id: 2, position: { end: true } },
{ id: 1, position: { before: 2 } },
{
id: 3,
position: { before: 1 },
},
{ id: 1, position: { before: 2 } },
{ id: 2, position: { end: true } },
],
disconnect: [],
},
@ -880,14 +880,14 @@ describe('CM || components || EditViewDataManagerProvider || utils || cleanData'
expect(result).toStrictEqual({
relation: {
connect: [
{
id: 3,
position: { before: 4 },
},
{
id: 4,
position: { end: true },
},
{
id: 3,
position: { before: 4 },
},
],
disconnect: [],
},