From 7968d2c3c8ad5a5061d553e9a1828c8f1f2ed1d9 Mon Sep 17 00:00:00 2001 From: Li zhongyu <65432159+shifang0511@users.noreply.github.com> Date: Wed, 3 Jun 2026 11:48:59 +0800 Subject: [PATCH] refactor(web): migrate workflow-variable-inpsect-panel-height to useSetLocalStorage (#36982) Co-authored-by: Claude Opus 4.6 Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- eslint-suppressions.json | 5 ----- web/app/components/workflow/variable-inspect/index.tsx | 7 +++++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/eslint-suppressions.json b/eslint-suppressions.json index d14a78b05a..daab54558c 100644 --- a/eslint-suppressions.json +++ b/eslint-suppressions.json @@ -4894,11 +4894,6 @@ "count": 2 } }, - "web/app/components/workflow/variable-inspect/index.tsx": { - "no-restricted-globals": { - "count": 1 - } - }, "web/app/components/workflow/variable-inspect/left.tsx": { "ts/no-explicit-any": { "count": 1 diff --git a/web/app/components/workflow/variable-inspect/index.tsx b/web/app/components/workflow/variable-inspect/index.tsx index 08314a1836..828c992d9d 100644 --- a/web/app/components/workflow/variable-inspect/index.tsx +++ b/web/app/components/workflow/variable-inspect/index.tsx @@ -5,6 +5,7 @@ import { useCallback, useMemo, } from 'react' +import { useSetLocalStorage } from '@/hooks/use-local-storage' import { useResizePanel } from '../nodes/_base/hooks/use-resize-panel' import { useStore } from '../store' import Panel from './panel' @@ -21,10 +22,12 @@ const VariableInspectPanel: FC = () => { return workflowCanvasHeight - 60 }, [workflowCanvasHeight]) + const setPanelHeightStorage = useSetLocalStorage('workflow-variable-inpsect-panel-height', { raw: true }) + const handleResize = useCallback((width: number, height: number) => { - localStorage.setItem('workflow-variable-inpsect-panel-height', `${height}`) + setPanelHeightStorage(`${height}`) setVariableInspectPanelHeight(height) - }, [setVariableInspectPanelHeight]) + }, [setVariableInspectPanelHeight, setPanelHeightStorage]) const { triggerRef,