refactor(core): emit pane ready after timeout of 1ms

This commit is contained in:
braks
2024-01-29 21:56:44 +01:00
committed by Braks
parent 308cff5f45
commit abe6006a09
+17 -13
View File
@@ -209,6 +209,12 @@ export function useActions(
return res
}, [])
if (!state.fitViewOnInitDone && state.fitViewOnInit) {
viewportHelper.value.fitView()
}
state.fitViewOnInitDone = true
if (changes.length) {
state.hooks.nodesChange.trigger(changes)
}
@@ -964,19 +970,17 @@ export function useActions(
until(() => viewportHelper.value.initialized)
.toBe(true)
.then(async () => {
if (state.fitViewOnInit) {
await viewportHelper.value.fitView()
}
state.hooks.paneReady.trigger({
id,
emits,
vueFlowVersion: typeof __VUE_FLOW_VERSION__ !== 'undefined' ? __VUE_FLOW_VERSION__ : 'UNKNOWN',
...hooksOn,
...state,
...getters,
...actions,
})
setTimeout(() => {
state.hooks.paneReady.trigger({
id,
emits,
vueFlowVersion: typeof __VUE_FLOW_VERSION__ !== 'undefined' ? __VUE_FLOW_VERSION__ : 'UNKNOWN',
...hooksOn,
...state,
...getters,
...actions,
})
}, 1)
})
return actions