refactor(web): migrate debug-and-preview-panel-width to useSetLocalStorage (#36977)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
Li zhongyu 2026-06-03 11:27:15 +08:00 committed by GitHub
parent ca31762e26
commit 7507e9ba67
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 7 deletions

View File

@ -4679,11 +4679,6 @@
"count": 12
}
},
"web/app/components/workflow/panel/debug-and-preview/index.tsx": {
"no-restricted-globals": {
"count": 1
}
},
"web/app/components/workflow/panel/env-panel/variable-modal.tsx": {
"no-restricted-imports": {
"count": 1

View File

@ -19,6 +19,7 @@ import { RefreshCcw01 } from '@/app/components/base/icons/src/vender/line/arrows
import { useEdgesInteractionsWithoutSync } from '@/app/components/workflow/hooks/use-edges-interactions-without-sync'
import { useNodesInteractionsWithoutSync } from '@/app/components/workflow/hooks/use-nodes-interactions-without-sync'
import { useStore } from '@/app/components/workflow/store'
import { useSetLocalStorage } from '@/hooks/use-local-storage'
import {
useWorkflowInteractions,
} from '../../hooks'
@ -54,11 +55,12 @@ const DebugAndPreview = () => {
const nodePanelWidth = useStore(s => s.nodePanelWidth)
const panelWidth = useStore(s => s.previewPanelWidth)
const setPanelWidth = useStore(s => s.setPreviewPanelWidth)
const setPanelWidthStorage = useSetLocalStorage<string>('debug-and-preview-panel-width', { raw: true })
const handleResize = useCallback((width: number, source: 'user' | 'system' = 'user') => {
if (source === 'user')
localStorage.setItem('debug-and-preview-panel-width', `${width}`)
setPanelWidthStorage(`${width}`)
setPanelWidth(width)
}, [setPanelWidth])
}, [setPanelWidth, setPanelWidthStorage])
const maxPanelWidth = useMemo(() => {
if (!workflowCanvasWidth)
return 720