Refresh custom node useNode on graph reload #963
-
Good morning, apologies if this question has already been asked. <template>
<div>
<div>
<strong>{{node?.label ?? ""}}</strong>
</div>
<div>{{node.data.additionalText}}</div>
</div>
</template>
<script setup lang="ts">
import { useNode } from '@vue-flow/core'
const { node } = useNode();
</script> Now, the problem is that the custom node "label" and "additionalText" don't refresh when the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Can you provide a sandbox for this issue? |
Beta Was this translation helpful? Give feedback.
-
Here you are @bcakmakoglu, please notice how the custom label doesn't change from "Custom" to "ABC" when pressing the button... https://stackblitz.com/edit/vitejs-vite-busjzd?embed=1&file=src%2FApp.vue |
Beta Was this translation helpful? Give feedback.
Try this instead: https://stackblitz.com/edit/vitejs-vite-piblhn?file=src%2FApp.vue
The issue here is that
useNode
currently does not supply a reactive node obj, but will only callfindNode
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 :/