diff --git a/packages/nc-gui/components/erd/Flow.vue b/packages/nc-gui/components/erd/Flow.vue index bf39c4c062..0f2f2e9ab9 100644 --- a/packages/nc-gui/components/erd/Flow.vue +++ b/packages/nc-gui/components/erd/Flow.vue @@ -22,7 +22,7 @@ const { tables, config } = defineProps() const { metasWithIdAsKey } = useMetas() -const { $destroy, fitView } = useVueFlow({ minZoom: 0.1, maxZoom: 2 }) +const { $destroy, fitView, onPaneReady, updateNodeInternals } = useVueFlow({ minZoom: 0.1, maxZoom: 2 }) const nodes = ref([]) const edges = ref([]) @@ -179,13 +179,18 @@ const layoutNodes = () => { }) } +onPaneReady(() => { + setTimeout(() => { + fitView({ duration: 300 }) + updateNodeInternals(nodes.value.map((n) => n.id)) + }, 100) +}) + const init = () => { initDagre() populateInitialNodes() populateEdges() layoutNodes() - - setTimeout(() => fitView({ duration: 300 })) } init()