mobx: `mobx-react-lite@4.0.2` observer not triggering component re-renders
The observer of mobx-react-lite seems to not trigger the wrapped component to re-renders after upgrading from mobx-react-lite@3.4.3 to mobx-react-lite@4.0.2.
Intended outcome:
When an observable value changes in the store, the observer component should re-render with the new value.
Actual outcome:
The observer component does not re-render when the observable value is updated.
How to reproduce the issue:
Code Sandbox: https://codesandbox.io/s/new-dawn-b2shxq?file=/src/App.js
Clicking “Push new element to data” button will push a new element to the store.data array using a store action.
However, the component does not re-render even thought store.data has been updated (see console logs).
If you change the mobx-react-lite version from 4.0.2 to 3.4.3 in the sandbox, the component will re-render when you click the “Push new element to data” button.
Versions
mobx-react-lite@4.0.2
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 6
- Comments: 17 (5 by maintainers)
Reverted
latesttag back to mobx-react@7.6.0 / mobx-react-lite@3.4.3, and deprecated the newer majors.We reverted the 4.x release, we’ll release it again, but needs some more time. For now stick to 3.x
On Wed, 26 Apr 2023, 09:33 YoungSeon.Ahn, @.***> wrote:
mobx-react v8.0.0 broke my apps. I wrap my app in
StrictModein development. If I removeStrictMode, it all works again. I already pushed another app to production butStrictModeis disabled in production so I dodged a bullet there.