From 75cb0c9b1ec8f02ba334762fd7c84fee7ea9e92f Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Sun, 5 Nov 2023 10:26:20 +0100 Subject: [PATCH] chore(core): cleanup --- packages/core/src/components/Handle/Handle.vue | 4 ++-- packages/core/src/composables/useWatchProps.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/core/src/components/Handle/Handle.vue b/packages/core/src/components/Handle/Handle.vue index ef6166a1..d634ffa1 100644 --- a/packages/core/src/components/Handle/Handle.vue +++ b/packages/core/src/components/Handle/Handle.vue @@ -15,9 +15,9 @@ const { ...props } = defineProps() -const type = toRef(props, 'type', 'source') +const type = toRef(() => props.type ?? 'source') -const isValidConnection = toRef(props, 'isValidConnection', undefined) +const isValidConnection = toRef(() => props.isValidConnection ?? null) const { connectionStartHandle, diff --git a/packages/core/src/composables/useWatchProps.ts b/packages/core/src/composables/useWatchProps.ts index 8eed7457..4c39edb7 100644 --- a/packages/core/src/composables/useWatchProps.ts +++ b/packages/core/src/composables/useWatchProps.ts @@ -1,4 +1,4 @@ -import type { ToRefs } from 'vue' +import type { Ref, ToRefs } from 'vue' import { effectScope, nextTick, onScopeDispose, toRef, watch } from 'vue' import type { WatchPausableReturn } from '@vueuse/core' import { watchPausable } from '@vueuse/core' @@ -287,15 +287,15 @@ export function useWatchProps( Object.keys(props).forEach((prop) => { if (!skip.includes(prop as keyof typeof props)) { - const model = toRef(props, prop as keyof typeof props) - const storedValue = store[prop as keyof typeof store] as typeof model + const model = toRef(() => prop) + const storeRef = store[prop as keyof typeof store] as typeof model as Ref scope.run(() => { watch( model, (nextValue) => { if (isDef(nextValue)) { - storedValue.value = nextValue + storeRef.value = nextValue } }, { flush: 'pre' },