Skip to content

Commit

Permalink
fix(svelte): variantState should not be modified by component interna…
Browse files Browse the repository at this point in the history
…l state (#271)
  • Loading branch information
sun0day committed Oct 8, 2022
1 parent 095d516 commit af78b46
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/histoire-plugin-svelte/src/client/util.ts
@@ -1,5 +1,5 @@
import { watch as _watch } from '@histoire/vendors/vue'
import { applyState } from '@histoire/shared'
import { applyState, clone } from '@histoire/shared'

function cleanupState (state: Record<string, any>): Record<string, any> {
const result = {}
Expand Down Expand Up @@ -32,7 +32,7 @@ export function syncState (variantState, onChange: (state) => unknown) {
if (value == null) return
if (!syncing) {
syncing = true
applyState(variantState, cleanupState(value))
applyState(variantState, clone(cleanupState(value)))
} else {
syncing = false
}
Expand Down

0 comments on commit af78b46

Please sign in to comment.