Skip to content

Commit ba05dce

Browse files
committed
fix: nuxt-3-error-with-custom-directives
1 parent eb7c01d commit ba05dce

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/directive/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Directive, DirectiveBinding, Ref, VNode } from 'vue'
22
import defu from 'defu'
3-
import { ref, unref } from 'vue'
3+
import { ref, toRaw, unref } from 'vue'
44
import { motionState } from '../features/state'
55
import type { MotionInstance, MotionVariants } from '../types'
66
import { useMotion } from '../useMotion'
@@ -21,7 +21,7 @@ export function directive<T extends string>(
2121
motionState[key].stop()
2222

2323
// We deep copy presets to prevent global mutation
24-
const variantsObject = isPreset ? structuredClone(variants || {}) : variants || {}
24+
const variantsObject = isPreset ? structuredClone(toRaw(variants) || {}) : variants || {}
2525

2626
// Initialize variants with argument
2727
const variantsRef = ref(variantsObject) as Ref<MotionVariants<T>>

0 commit comments

Comments
 (0)