Skip to content

Commit 96e93f5

Browse files
fix(overmind-vue): only send update to devtools when flushing
1 parent eea42e8 commit 96e93f5

File tree

1 file changed

+12
-7
lines changed
  • packages/node_modules/overmind-vue/src

1 file changed

+12
-7
lines changed

packages/node_modules/overmind-vue/src/index.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ function createMixin(overmind, propsCallback) {
3434
componentInstanceId: componentInstanceId++,
3535
onUpdate: (mutations, paths, flushId) => {
3636
this[OVERMIND].currentFlushId = flushId
37+
this[OVERMIND].isUpdating = true
3738
this.$forceUpdate()
3839
},
40+
isUpdating: false,
3941
}
4042
this.overmind = {
4143
state: this[OVERMIND].tree.state,
@@ -84,13 +86,16 @@ function createMixin(overmind, propsCallback) {
8486

8587
this[OVERMIND].tree.stopTracking()
8688

87-
overmind.eventHub.emitAsync(EventType.COMPONENT_UPDATE, {
88-
componentId,
89-
componentInstanceId: this[OVERMIND].componentInstanceId,
90-
name: this.$options.name || '',
91-
flushId: this[OVERMIND].currentFlushId,
92-
paths: Array.from(this[OVERMIND].tree.pathDependencies) as any,
93-
})
89+
if (this[OVERMIND].isUpdating) {
90+
overmind.eventHub.emitAsync(EventType.COMPONENT_UPDATE, {
91+
componentId,
92+
componentInstanceId: this[OVERMIND].componentInstanceId,
93+
name: this.$options.name || '',
94+
flushId: this[OVERMIND].currentFlushId,
95+
paths: Array.from(this[OVERMIND].tree.pathDependencies) as any,
96+
})
97+
this[OVERMIND].isUpdating = false
98+
}
9499
},
95100
}),
96101
beforeDestroy(this: any) {

0 commit comments

Comments
 (0)