update(nodes): watch nodes width for dimension update

* add force param to setElements, if set we clear the elements arr (default true)
* wait for store watcher until store is ready (i.e. a state has been set)
* move renderer css class to Renderer.vue

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
Braks
2021-11-25 19:29:13 +01:00
parent 5b00049a65
commit 0b2764028f
9 changed files with 46 additions and 32 deletions
+4 -6
View File
@@ -11,11 +11,7 @@ const props = defineProps<RendererProps>()
const store = useStore()
// if there are preloaded elements we overwrite the current elements with the stored ones and reset the stored elements (so we can properly parse them)
const hasInitialElements = store.elements.length
const initialElements = hasInitialElements ? store.elements : props.elements
if (hasInitialElements) store.elements = []
await store.setElements(initialElements)
await store.setElements(props.elements, false)
store.isReady = true
nextTick(async () => {
@@ -45,5 +41,7 @@ export default {
}
</script>
<template>
<slot />
<div class="vue-flow__renderer">
<slot />
</div>
</template>