Skip to content

Commit

Permalink
fix: use toRaw when cloning proxy object (#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
hajiskyy authored Aug 28, 2024
1 parent a33c5b9 commit 47ad58d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/directive/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Directive, DirectiveBinding, Ref, VNode } from 'vue'
import defu from 'defu'
import { ref, unref } from 'vue'
import { ref, toRaw, unref } from 'vue'
import { motionState } from '../features/state'
import type { MotionInstance, MotionVariants } from '../types'
import { useMotion } from '../useMotion'
Expand All @@ -21,7 +21,7 @@ export function directive<T extends string>(
motionState[key].stop()

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

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

0 comments on commit 47ad58d

Please sign in to comment.