Skip to content

Commit fd155e4

Browse files
committed
fix(core): wait for viewport helper in fromObject action
1 parent f28318e commit fd155e4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/core/src/store/actions.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,15 @@ export function useActions(
844844
}
845845

846846
if (position) {
847-
viewportHelper.value.setTransform({ x: position[0], y: position[1], zoom: zoom || 1 })
847+
until(() => viewportHelper.value.initialized)
848+
.toBe(true)
849+
.then(() => {
850+
viewportHelper.value.setViewport({
851+
x: position[0],
852+
y: position[1],
853+
zoom: zoom || state.viewport.zoom,
854+
})
855+
})
848856
}
849857
}
850858

0 commit comments

Comments
 (0)