diff --git a/packages/core/src/store/actions.ts b/packages/core/src/store/actions.ts index 42d2668b..3ab5a1e4 100644 --- a/packages/core/src/store/actions.ts +++ b/packages/core/src/store/actions.ts @@ -21,6 +21,8 @@ import type { } from '~/types' export function useActions(state: State, getters: ComputedGetters): Actions { + let fitViewOnInitDone = false + const updateNodeInternals: Actions['updateNodeInternals'] = (ids) => { state.hooks.updateNodeInternals.trigger(ids) } @@ -151,6 +153,13 @@ export function useActions(state: State, getters: ComputedGetters): Actions { return res }, []) + if (state.fitViewOnInit && !fitViewOnInitDone) { + paneReady().then((helper) => { + helper.fitView() + fitViewOnInitDone = true + }) + } + if (changes.length) state.hooks.nodesChange.trigger(changes) }