From 766822d04b93e2453a75af7abce0dffd1e6f8d43 Mon Sep 17 00:00:00 2001 From: Brian Pursley Date: Wed, 24 Dec 2025 05:16:47 -0500 Subject: [PATCH] Fix dashboard drag error (#16731) Fixes https://github.com/twentyhq/twenty/issues/16730 --- .../hooks/__tests__/usePageLayoutHandleLayoutChange.test.tsx | 1 + .../page-layout/hooks/usePageLayoutHandleLayoutChange.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) 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 9cc2e0c6f0..032d491f84 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 d26ce85ee6..bdb34b2a96 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