Skip to content

Commit eea42e8

Browse files
fix(overmind-react): only pass update to devtools when update from flush
1 parent ef37add commit eea42e8

File tree

1 file changed

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

1 file changed

+12
-7
lines changed

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ export const createConnect = <ThisConfig extends IConfiguration>(
276276
state: {
277277
overmind: any
278278
}
279+
isUpdating: boolean
279280
static contextType = context
280281
constructor(props, context) {
281282
super(props)
@@ -301,13 +302,16 @@ export const createConnect = <ThisConfig extends IConfiguration>(
301302
})
302303
}
303304
componentDidUpdate() {
304-
this.overmind.eventHub.emitAsync(EventType.COMPONENT_UPDATE, {
305-
componentId: populatedComponent.__componentId,
306-
componentInstanceId: this.componentInstanceId,
307-
name,
308-
flushId: this.currentFlushId,
309-
paths: Array.from(this.tree.pathDependencies as Set<string>),
310-
})
305+
if (this.isUpdating) {
306+
this.overmind.eventHub.emitAsync(EventType.COMPONENT_UPDATE, {
307+
componentId: populatedComponent.__componentId,
308+
componentInstanceId: this.componentInstanceId,
309+
name,
310+
flushId: this.currentFlushId,
311+
paths: Array.from(this.tree.pathDependencies as Set<string>),
312+
})
313+
this.isUpdating = false
314+
}
311315
}
312316
componentWillUnmount() {
313317
this.overmind.proxyStateTree.disposeTree(this.tree)
@@ -319,6 +323,7 @@ export const createConnect = <ThisConfig extends IConfiguration>(
319323
}
320324
onUpdate = (mutatons, paths, flushId) => {
321325
this.currentFlushId = flushId
326+
this.isUpdating = true
322327
this.setState({
323328
overmind: {
324329
state: this.tree.state,

0 commit comments

Comments
 (0)