Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

refactor(web): migrate workflow-variable-inpsect-panel-height to useSetLocalStorage (#36982)

Li zhongyu7968d2c3c8ad
diff --git a/eslint-suppressions.json b/eslint-suppressions.json
index d14a78b05a7..daab54558ce 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 08314a1836a..828c992d9d7 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<string>('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,