Skip to content

Commit 8fa0808

Browse files
feat(overmind): show component name on reactions
1 parent ecdc844 commit 8fa0808

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

packages/node_modules/overmind/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,15 +335,15 @@ export default class App<
335335
addMutationListener(paths, cb) {
336336
return this.proxyStateTree.addMutationListener(paths, cb)
337337
}
338-
createReactionFactory() {
338+
createReactionFactory(prefix: string) {
339339
const reactions = []
340340
const instance = this
341341
return {
342342
add(name: string, stateCb: (state: State) => any, cb: Function) {
343343
const reaction = new Reaction(
344344
instance.eventHub,
345345
instance.proxyStateTree,
346-
'view.' + name
346+
prefix + '.' + name
347347
)
348348
reaction.create(stateCb, cb)
349349

packages/node_modules/overmind/src/views/react.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ export default class ReactApp<
118118
__mutationListener: any
119119
__componentId = componentId
120120
__componentInstanceId = componentInstanceId++
121-
__reactionFactory = instance.createReactionFactory()
121+
__reactionFactory = instance.createReactionFactory(
122+
Component.name || Component.displayName
123+
)
122124
componentWillUnmount() {
123125
if (this.__mutationListener) {
124126
if (instance.devtools) {

0 commit comments

Comments
 (0)