#useNodesInitialized does not update when new nodes are introduced

1 messages · Page 1 of 1 (latest)

sage radish
#

I'm having an issue when using useNodesInitialized, when i update the nodes store, the initialized store doesn't update to false, even tho the new nodes are not yet initialized

<script lang='ts'>
  const nodesStore = client.relationsTree(media) // adds new nodes every few hundred MS

  const nodes = writable<Node[]>([])
  const edges = writable<Edge[]>([])

  $: $nodes = [...$nodesStore.nodes.values()]
  $: $edges = [...$nodesStore.edges.values()]

  const initialized = useNodesInitialized()

  $: console.log($initialized) // false, true, no further updates if new nodes are introduced
  
  function onLayout(nodes) {
    // do stuff with node.measured.width/height, will error as width/height can be undefined, initialized lies
  }
  
  $: if ($initialized) onLayout($nodes)
</script>

<SvelteFlow {nodes} {edges} colorMode='dark'
  proOptions={{ hideAttribution: true }}
  nodesConnectable={false}
  nodesDraggable={false}
  panOnScroll={false}
  zoomOnScroll={expanded}
  preventScrolling={expanded}
  onlyRenderVisibleElements={true}
  minZoom={0}
  maxZoom={1.2}
  elementsSelectable={false}>
  <Background bgColor='black' />
</SvelteFlow>
sage radish
#

bump?

forest mulch
#

@mystic shard kindly look into this question whenever you find time.