From bb0b9049eaf1aef273d99872c701527824c6a5f0 Mon Sep 17 00:00:00 2001 From: Braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Thu, 25 Nov 2021 14:20:59 +0100 Subject: [PATCH] fix(flow): props not being watched on time * updated example for UpdateNode Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com> --- examples/UpdateNode/UpdateNodeExample.vue | 21 ++++++----- src/container/VueFlow/VueFlow.vue | 46 +++++++++++------------ 2 files changed, 34 insertions(+), 33 deletions(-) diff --git a/examples/UpdateNode/UpdateNodeExample.vue b/examples/UpdateNode/UpdateNodeExample.vue index c4c4ae88..16787a60 100644 --- a/examples/UpdateNode/UpdateNodeExample.vue +++ b/examples/UpdateNode/UpdateNodeExample.vue @@ -10,9 +10,11 @@ const initialElements: Elements = [ ] const elements = ref(initialElements) -const nodeName = ref('Node 1') -const nodeBg = ref('#eee') -const nodeHidden = ref(false) +const opts = ref({ + bg: '#eee', + name: 'Node 1', + hidden: false, +}) const updateNode = () => { elements.value = elements.value.map((el) => { @@ -20,29 +22,30 @@ const updateNode = () => { // it's important that you create a new object here in order to notify react flow about the change el.data = { ...el.data, - label: nodeName.value, + label: opts.value.name, } - el.style = { backgroundColor: nodeBg.value } - el.isHidden = nodeHidden.value + el.style = { backgroundColor: opts.value.bg } + el.isHidden = opts.value.hidden } return el }) } + onMounted(updateNode)