revert structuredClone as it is not supported on proxy objects

This commit is contained in:
Amruth Pillai
2024-05-10 11:27:13 +02:00
parent a102f62e28
commit c15d9f7645
10 changed files with 15 additions and 14 deletions

View File

@ -34,7 +34,7 @@ export const moveItemInLayout = (
): string[][][] => {
try {
// Create a deep copy of the layout to avoid mutating the original array
const newLayout = structuredClone(layout);
const newLayout = JSON.parse(JSON.stringify(layout));
// Get the item from the current location
const item = newLayout[current.page][current.column][current.section];

View File

@ -84,7 +84,7 @@ describe("moveItemInLayout", () => {
[["item1"], ["item2"]],
[["item3"], ["item4"]],
];
const layoutCopy = structuredClone(layout);
const layoutCopy = JSON.parse(JSON.stringify(layout));
const current = { page: 0, column: 1, section: 0 };
const target = { page: 1, column: 0, section: 1 };