From 1cf3e599dfad47e72271cdf028b4cbb3c9902aff Mon Sep 17 00:00:00 2001 From: yyh Date: Sun, 18 Jan 2026 16:33:59 +0800 Subject: [PATCH] fix: remove panelWidth prop in panel slice, use default value 420 in layout slice(single source) --- .../workflow/nodes/_base/components/editor/wrap.tsx | 4 ++-- web/app/components/workflow/store/workflow/layout-slice.ts | 2 +- web/app/components/workflow/store/workflow/panel-slice.ts | 4 ---- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/web/app/components/workflow/nodes/_base/components/editor/wrap.tsx b/web/app/components/workflow/nodes/_base/components/editor/wrap.tsx index 4ebedfe596..5fc042501c 100644 --- a/web/app/components/workflow/nodes/_base/components/editor/wrap.tsx +++ b/web/app/components/workflow/nodes/_base/components/editor/wrap.tsx @@ -26,12 +26,12 @@ const Wrap = ({ isExpand, children, }: Props) => { - const panelWidth = useStore(state => state.panelWidth) + const nodePanelWidth = useStore(state => state.nodePanelWidth) const wrapStyle = (() => { if (isExpand) { return { ...style, - width: panelWidth - 1, + width: nodePanelWidth - 1, } } return style diff --git a/web/app/components/workflow/store/workflow/layout-slice.ts b/web/app/components/workflow/store/workflow/layout-slice.ts index a55c93dec1..6112a5de8f 100644 --- a/web/app/components/workflow/store/workflow/layout-slice.ts +++ b/web/app/components/workflow/store/workflow/layout-slice.ts @@ -32,7 +32,7 @@ export const createLayoutSlice: StateCreator = set => ({ setWorkflowCanvasHeight: height => set(() => ({ workflowCanvasHeight: height })), rightPanelWidth: undefined, setRightPanelWidth: width => set(() => ({ rightPanelWidth: width })), - nodePanelWidth: storage.getNumber(STORAGE_KEYS.WORKFLOW.NODE_PANEL_WIDTH, 400), + nodePanelWidth: storage.getNumber(STORAGE_KEYS.WORKFLOW.NODE_PANEL_WIDTH, 420), setNodePanelWidth: width => set(() => ({ nodePanelWidth: width })), previewPanelWidth: storage.getNumber(STORAGE_KEYS.WORKFLOW.PREVIEW_PANEL_WIDTH, 400), setPreviewPanelWidth: width => set(() => ({ previewPanelWidth: width })), diff --git a/web/app/components/workflow/store/workflow/panel-slice.ts b/web/app/components/workflow/store/workflow/panel-slice.ts index a9e22f32e2..c46b5aec7e 100644 --- a/web/app/components/workflow/store/workflow/panel-slice.ts +++ b/web/app/components/workflow/store/workflow/panel-slice.ts @@ -1,9 +1,6 @@ import type { StateCreator } from 'zustand' -import { STORAGE_KEYS } from '@/config/storage-keys' -import { storage } from '@/utils/storage' export type PanelSliceShape = { - panelWidth: number showFeaturesPanel: boolean setShowFeaturesPanel: (showFeaturesPanel: boolean) => void showWorkflowVersionHistoryPanel: boolean @@ -29,7 +26,6 @@ export type PanelSliceShape = { } export const createPanelSlice: StateCreator = set => ({ - panelWidth: storage.getNumber(STORAGE_KEYS.WORKFLOW.NODE_PANEL_WIDTH, 420), showFeaturesPanel: false, setShowFeaturesPanel: showFeaturesPanel => set(() => ({ showFeaturesPanel })), showWorkflowVersionHistoryPanel: false,