Skip to content

The open alternative to Salesforce, designed for AI.

Fix dashboard drag error (#16731)

Brian Pursley766822d04b93
diff --git a/packages/twenty-front/src/modules/page-layout/hooks/__tests__/usePageLayoutHandleLayoutChange.test.tsx b/packages/twenty-front/src/modules/page-layout/hooks/__tests__/usePageLayoutHandleLayoutChange.test.tsx
index 9cc2e0c6f09..032d491f840 100644
--- a/packages/twenty-front/src/modules/page-layout/hooks/__tests__/usePageLayoutHandleLayoutChange.test.tsx
+++ b/packages/twenty-front/src/modules/page-layout/hooks/__tests__/usePageLayoutHandleLayoutChange.test.tsx
@@ -52,6 +52,7 @@ describe('usePageLayoutHandleLayoutChange', () => {
});
expect(result.current.layouts['tab-1']).toEqual(newLayouts);
+ expect(result.current.layouts['tab-1']).not.toBe(newLayouts); // Ensure a clone was set, not the same reference
expect(result.current.layouts['tab-2']).toBeUndefined();
});
diff --git a/packages/twenty-front/src/modules/page-layout/hooks/usePageLayoutHandleLayoutChange.ts b/packages/twenty-front/src/modules/page-layout/hooks/usePageLayoutHandleLayoutChange.ts
index d26ce85ee6f..bdb34b2a968 100644
--- a/packages/twenty-front/src/modules/page-layout/hooks/usePageLayoutHandleLayoutChange.ts
+++ b/packages/twenty-front/src/modules/page-layout/hooks/usePageLayoutHandleLayoutChange.ts
@@ -48,7 +48,7 @@ export const usePageLayoutHandleLayoutChange = (
set(pageLayoutCurrentLayoutsState, {
...currentTabLayouts,
- [activeTabId]: allLayouts,
+ [activeTabId]: structuredClone(allLayouts),
});
const pageLayoutDraft = snapshot