fix: remove panelWidth prop in panel slice, use default value 420 in layout slice(single source)

This commit is contained in:
yyh
2026-01-18 16:33:59 +08:00
parent a85946d3e7
commit 1cf3e599df
3 changed files with 3 additions and 7 deletions

View File

@ -26,12 +26,12 @@ const Wrap = ({
isExpand,
children,
}: Props) => {
const panelWidth = useStore(state => state.panelWidth)
const nodePanelWidth = useStore(state => state.nodePanelWidth)
const wrapStyle = (() => {
if (isExpand) {
return {
...style,
width: panelWidth - 1,
width: nodePanelWidth - 1,
}
}
return style

View File

@ -32,7 +32,7 @@ export const createLayoutSlice: StateCreator<LayoutSliceShape> = set => ({
setWorkflowCanvasHeight: height => set(() => ({ workflowCanvasHeight: height })),
rightPanelWidth: undefined,
setRightPanelWidth: width => set(() => ({ rightPanelWidth: width })),
nodePanelWidth: storage.getNumber(STORAGE_KEYS.WORKFLOW.NODE_PANEL_WIDTH, 400),
nodePanelWidth: storage.getNumber(STORAGE_KEYS.WORKFLOW.NODE_PANEL_WIDTH, 420),
setNodePanelWidth: width => set(() => ({ nodePanelWidth: width })),
previewPanelWidth: storage.getNumber(STORAGE_KEYS.WORKFLOW.PREVIEW_PANEL_WIDTH, 400),
setPreviewPanelWidth: width => set(() => ({ previewPanelWidth: width })),

View File

@ -1,9 +1,6 @@
import type { StateCreator } from 'zustand'
import { STORAGE_KEYS } from '@/config/storage-keys'
import { storage } from '@/utils/storage'
export type PanelSliceShape = {
panelWidth: number
showFeaturesPanel: boolean
setShowFeaturesPanel: (showFeaturesPanel: boolean) => void
showWorkflowVersionHistoryPanel: boolean
@ -29,7 +26,6 @@ export type PanelSliceShape = {
}
export const createPanelSlice: StateCreator<PanelSliceShape> = set => ({
panelWidth: storage.getNumber(STORAGE_KEYS.WORKFLOW.NODE_PANEL_WIDTH, 420),
showFeaturesPanel: false,
setShowFeaturesPanel: showFeaturesPanel => set(() => ({ showFeaturesPanel })),
showWorkflowVersionHistoryPanel: false,