mirror of
https://github.com/langgenius/dify.git
synced 2026-06-07 16:23:44 +08:00
refactor(web): migrate workflow-node-panel-width to useSetLocalStorage (#36983)
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:
parent
1b972c4e09
commit
1e76b9e1b8
@ -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
|
||||
},
|
||||
|
||||
@ -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<BasePanelProps> = ({
|
||||
const setNodePanelWidth = useStore(s => s.setNodePanelWidth)
|
||||
const pendingSingleRun = useStore(s => s.pendingSingleRun)
|
||||
const setPendingSingleRun = useStore(s => s.setPendingSingleRun)
|
||||
const setNodePanelWidthStorage = useSetLocalStorage<string>('workflow-node-panel-width', { raw: true })
|
||||
|
||||
const reservedCanvasWidth = 400 // Reserve the minimum visible width for the canvas
|
||||
|
||||
@ -169,10 +171,10 @@ const BasePanel: FC<BasePanelProps> = ({
|
||||
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')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user