From 127bb683a9533e2d7f014cdd8b9352e098691e5d Mon Sep 17 00:00:00 2001 From: Peng Xiao Date: Tue, 31 Dec 2024 16:25:31 +0800 Subject: [PATCH] fix(core): split view reordering crash --- .../workbench/view/split-view/split-view.tsx | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/packages/frontend/core/src/modules/workbench/view/split-view/split-view.tsx b/packages/frontend/core/src/modules/workbench/view/split-view/split-view.tsx index 6ff0011e0bc23..9a7f8feefc20a 100644 --- a/packages/frontend/core/src/modules/workbench/view/split-view/split-view.tsx +++ b/packages/frontend/core/src/modules/workbench/view/split-view/split-view.tsx @@ -50,6 +50,8 @@ export const SplitView = ({ const { appSettings } = useAppSettingHelper(); const workbench = useService(WorkbenchService).workbench; + const [visible, setVisibility] = useState(true); + const sensors = useSensors( useSensor( PointerSensor, @@ -102,7 +104,15 @@ export const SplitView = ({ const fromIndex = views.findIndex(v => v.id === active.id); const toIndex = views.findIndex(v => v.id === over?.id); onMove?.(fromIndex, toIndex); + setVisibility(false); + const timeoutId = setTimeout(() => { + setVisibility(true); + }); + return () => { + clearTimeout(timeoutId); + }; } + return; }, [onMove, views] ); @@ -121,11 +131,13 @@ export const SplitView = ({ onDragEnd={handleDragEnd} > - {views.map((view, index) => ( - - {resizeHandleRenderer(view, index)} - - ))} + {views.map((view, index) => + visible ? ( + + {resizeHandleRenderer(view, index)} + + ) : null + )}