Skip to content

Commit

Permalink
fix(vue3): state sync hang
Browse files Browse the repository at this point in the history
  • Loading branch information
Akryum committed Jul 22, 2022
1 parent df81aac commit 7c399fd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/histoire-plugin-vue/src/client/app/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,27 +91,29 @@ export function syncStateBundledAndExternal (bundledState, externalState) {
let syncing = false

const _stop = _watch(() => bundledState, value => {
if (!syncing && value != null) {
if (value == null) return
if (!syncing) {
syncing = true
applyState(externalState, _toRawDeep(value))
} else {
syncing = false
}
}, {
deep: true,
immediate: true,
flush: 'sync',
})

const stop = watch(() => externalState, value => {
if (!syncing && value != null) {
if (value == null) return
if (!syncing) {
syncing = true
applyState(bundledState, toRawDeep(value))
} else {
syncing = false
}
}, {
deep: true,
immediate: true,
flush: 'sync',
})

return {
Expand Down

0 comments on commit 7c399fd

Please sign in to comment.