I have reported this bug to react. a tl;dr is in strict mode, sometime react calls unsubscribe then immediately subscribe on useSyncExternalStore without getting snapshot or re-render
What this means to mobx-react-lite is, the useObserver destroy reaction in unsubscribe, then creates new reaction in subscribe, and depending on re-render to track that reaction. This react behaviour breaks this cycle.
I suggest we add a if(__DEV__) {onStoreChange()} to the subscribe method, to ensure a re-render is scheduled
I have reported this bug to react. a tl;dr is in strict mode, sometime react calls
unsubscribethen immediatelysubscribeonuseSyncExternalStorewithout getting snapshot or re-renderWhat this means to mobx-react-lite is, the
useObserverdestroy reaction inunsubscribe, then creates new reaction insubscribe, and depending on re-render to track that reaction. This react behaviour breaks this cycle.I suggest we add a
if(__DEV__) {onStoreChange()}to the subscribe method, to ensure a re-render is scheduled