Skip to content

Refresh custom node useNode on graph reload #963

Answered by bcakmakoglu
fabiomaistro asked this question in Q&A
Discussion options

You must be logged in to vote

Try this instead: https://stackblitz.com/edit/vitejs-vite-piblhn?file=src%2FApp.vue

<script setup lang="ts">
import { computed, inject } from 'vue';
import { useVueFlow, NodeIdInjection } from '@vue-flow/core';

const { findNode } = useVueFlow();

const node = computed(() => findNode(inject(NodeIdInjection)));
</script>

The issue here is that useNode currently does not supply a reactive node obj, but will only call findNode once and thus you're sort of stuck with the old node obj (before you overwrote it).

This will be fixed in 2.0.0 (relevant PR is ready here #640) but as this constitutes a breaking change, this will not be available in any 1.x.x version, sorry :/

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@bcakmakoglu
Comment options

Answer selected by fabiomaistro
@fabiomaistro
Comment options

@bcakmakoglu
Comment options

@bcakmakoglu
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
bug Something isn't working
2 participants