File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
packages/node_modules/overmind-react/src Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -73,7 +73,8 @@ export const createHook = <Config extends IConfiguration>(): (() => {
7373 }
7474 const useForceRerender = ( ) => {
7575 const [ flushId , setState ] = react . useState ( ( ) => - 1 )
76- const mountedRef = react . useRef ( true )
76+ // We use memo here, instead of ref, to support fast-refresh
77+ const mountedRef = react . useMemo ( ( ) => ( { current : true } ) , [ ] )
7778
7879 react . useEffect (
7980 ( ) => ( ) => {
@@ -109,8 +110,9 @@ export const createHook = <Config extends IConfiguration>(): (() => {
109110 reaction : overmind . reaction ,
110111 }
111112 }
112- const [ tree ] = react . useState < any > ( ( ) =>
113- ( overmind as any ) . proxyStateTree . getTrackStateTree ( )
113+
114+ const tree = react . useMemo < any > ( ( ) =>
115+ ( overmind as any ) . proxyStateTree . getTrackStateTree ( ) , [ ]
114116 )
115117
116118 if ( IS_PRODUCTION ) {
You can’t perform that action at this time.
0 commit comments