fix(core): update node dimensions on next tick

This commit is contained in:
braks
2024-02-05 07:51:12 +01:00
committed by Braks
parent 4d8cd3c1a4
commit 4bbc14b882
@@ -1,4 +1,4 @@
import { computed, defineComponent, h, onBeforeUnmount, onMounted, provide, ref, watch } from 'vue' import { computed, defineComponent, h, nextTick, onBeforeUnmount, onMounted, provide, ref, watch } from 'vue'
import { until, useVModel } from '@vueuse/core' import { until, useVModel } from '@vueuse/core'
import { import {
ARIA_NODE_DESC_KEY, ARIA_NODE_DESC_KEY,
@@ -121,13 +121,11 @@ const NodeWrapper = defineComponent({
props.resizeObserver.unobserve(nodeElement.value as HTMLDivElement) props.resizeObserver.unobserve(nodeElement.value as HTMLDivElement)
}) })
watch( watch([() => node.value.type, () => node.value.sourcePosition, () => node.value.targetPosition], () => {
[() => node.value.type, () => node.value.sourcePosition, () => node.value.targetPosition], nextTick(() => {
() => {
updateNodeDimensions([{ id: props.id, nodeElement: nodeElement.value as HTMLDivElement, forceUpdate: true }]) updateNodeDimensions([{ id: props.id, nodeElement: nodeElement.value as HTMLDivElement, forceUpdate: true }])
}, })
{ flush: 'pre' }, })
)
/** this watcher only updates XYZPosition (when dragging a parent etc) */ /** this watcher only updates XYZPosition (when dragging a parent etc) */
watch( watch(