diff --git a/eslint-suppressions.json b/eslint-suppressions.json index daab54558c..40255553fd 100644 --- a/eslint-suppressions.json +++ b/eslint-suppressions.json @@ -3748,9 +3748,6 @@ } }, "web/app/components/workflow/nodes/_base/components/workflow-panel/index.tsx": { - "no-restricted-globals": { - "count": 1 - }, "react/set-state-in-effect": { "count": 2 }, diff --git a/web/app/components/workflow/nodes/_base/components/workflow-panel/index.tsx b/web/app/components/workflow/nodes/_base/components/workflow-panel/index.tsx index 80f8c9466d..b53af61683 100644 --- a/web/app/components/workflow/nodes/_base/components/workflow-panel/index.tsx +++ b/web/app/components/workflow/nodes/_base/components/workflow-panel/index.tsx @@ -67,6 +67,7 @@ import { } from '@/app/components/workflow/utils' import { useAppContext } from '@/context/app-context' import { useModalContext } from '@/context/modal-context' +import { useSetLocalStorage } from '@/hooks/use-local-storage' import { useAllBuiltInTools } from '@/service/use-tools' import { useAllTriggerPlugins } from '@/service/use-triggers' import { FlowType } from '@/types/common' @@ -157,6 +158,7 @@ const BasePanel: FC = ({ const setNodePanelWidth = useStore(s => s.setNodePanelWidth) const pendingSingleRun = useStore(s => s.pendingSingleRun) const setPendingSingleRun = useStore(s => s.setPendingSingleRun) + const setNodePanelWidthStorage = useSetLocalStorage('workflow-node-panel-width', { raw: true }) const reservedCanvasWidth = 400 // Reserve the minimum visible width for the canvas @@ -169,10 +171,10 @@ const BasePanel: FC = ({ const newValue = clampNodePanelWidth(width, maxNodePanelWidth) if (source === 'user') - localStorage.setItem('workflow-node-panel-width', `${newValue}`) + setNodePanelWidthStorage(`${newValue}`) setNodePanelWidth(newValue) - }, [maxNodePanelWidth, setNodePanelWidth]) + }, [maxNodePanelWidth, setNodePanelWidth, setNodePanelWidthStorage]) const handleResize = useCallback((width: number) => { updateNodePanelWidth(width, 'user')