From 68b7d99a9c348bf51aeba9605ab7fc3560cd4e4c Mon Sep 17 00:00:00 2001 From: Braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Sat, 20 Nov 2021 02:15:12 +0100 Subject: [PATCH] fix: load hook timing Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com> --- src/container/ZoomPane/ZoomPane.vue | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/container/ZoomPane/ZoomPane.vue b/src/container/ZoomPane/ZoomPane.vue index 8a9d3206..607cae65 100644 --- a/src/container/ZoomPane/ZoomPane.vue +++ b/src/container/ZoomPane/ZoomPane.vue @@ -185,19 +185,22 @@ store.dimensions = { invoke(async () => { await until(() => !isNaN(width.value) && width.value > 0 && !isNaN(height.value) && height.value > 0).toBeTruthy() - const instance: FlowInstance = { - fitView: (params = { padding: 0.1 }) => fitView(params), - zoomIn, - zoomOut, - zoomTo, - setTransform, - project: onLoadProject(store), - getElements: onLoadGetElements(store), - toObject: onLoadToObject(store), - } - store.hooks.load.trigger(instance) - store.isReady = true - store.instance = instance + await until(store.elements).toMatch((y) => y.length > 0) + await nextTick(() => { + const instance: FlowInstance = { + fitView: (params = { padding: 0.1 }) => fitView(params), + zoomIn, + zoomOut, + zoomTo, + setTransform, + project: onLoadProject(store), + getElements: onLoadGetElements(store), + toObject: onLoadToObject(store), + } + store.hooks.load.trigger(instance) + store.isReady = true + store.instance = instance + }) }) watch(