File tree Expand file tree Collapse file tree 1 file changed +17
-7
lines changed
packages/overmind-react/src Expand file tree Collapse file tree 1 file changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -118,6 +118,23 @@ const useState = <Context extends IContext<{ state: {} }>>(
118118 currentComponentInstanceId ++
119119 )
120120
121+ React . useEffect ( ( ) => {
122+ overmind . eventHub . emitAsync ( EventType . COMPONENT_ADD , {
123+ componentId : component . __componentId ,
124+ componentInstanceId,
125+ name,
126+ paths : [ ] ,
127+ } )
128+
129+ return ( ) => {
130+ overmind . eventHub . emitAsync ( EventType . COMPONENT_REMOVE , {
131+ componentId : component . __componentId ,
132+ componentInstanceId,
133+ name,
134+ } )
135+ }
136+ } , [ ] )
137+
121138 React . useEffect ( ( ) => {
122139 overmind . eventHub . emitAsync ( EventType . COMPONENT_UPDATE , {
123140 componentId : component . __componentId ,
@@ -131,13 +148,6 @@ const useState = <Context extends IContext<{ state: {} }>>(
131148 } )
132149
133150 return ( ) => {
134- overmind . eventHub . emitAsync ( EventType . COMPONENT_UPDATE , {
135- componentId : component . __componentId ,
136- componentInstanceId,
137- name,
138- paths : [ ] ,
139- } )
140-
141151 dispose ( )
142152 }
143153 } , [ trackStateTree ] )
You can’t perform that action at this time.
0 commit comments