Skip to Content
Vue Flow v2 is here and joins xyflow! Read more here →
ReferenceComposables

useNodesInitialized()

Source on GitHub 

The useNodesInitialized composable returns a reactive boolean that becomes true once every node has been measured — i.e. its dimensions and handle bounds are known. It’s the signal to wait for before doing work that needs the real, measured node sizes, such as running your own layout.

<script setup lang="ts"> import { watch } from 'vue'; import { useNodesInitialized, useVueFlow } from '@xyflow/vue'; const nodesInitialized = useNodesInitialized(); const { getNodes, setNodes } = useVueFlow(); // lay the graph out once every node has real measured dimensions watch(nodesInitialized, (initialized) => { if (initialized) { setNodes(layout(getNodes.value)); } }); </script>

Signature

Parameters:
NameTypeDefault
options.includeHiddenNodesboolean

Whether hidden nodes must also be measured before the flow counts as initialized. When false, hidden nodes are ignored (the result can be true while some hidden nodes are still unmeasured).

false
Returns:
ComputedRef<boolean>

boolean indicating whether all nodes are initialized

Notes

  • Hidden nodes are ignored unless you pass { includeHiddenNodes: true }.
  • fitView() already waits for measurement internally, so you often don’t need this composable just to fit the view — reach for it when you have your own layout or measurement-dependent logic.