mobxjs / mobx-react

React bindings for MobX
https://mobx.js.org/react-integration.html
MIT License
4.85k stars 349 forks source link

observer causes app to break when using 0.61's fast refresh #784

Closed ertankara closed 5 years ago

ertankara commented 5 years ago

How to reproduce

Wrap your react native function component with observer and refresh twice, the first refresh doesn't break it but following refresh does.

Erorr is -> Invariant Violation: Rendered fewer hooks than expected. This may be caused by an accidental early return statement.

If I remove the observer it'll refresh without a problem, so I think this issue deserves to be here rather than on React-Native project.

danielkcz commented 5 years ago

Duplicate to https://github.com/mobxjs/mobx-react-lite/issues/226

It's more likely the fast refresh is a problem :)

gaearon commented 5 years ago

Just noting that the problem was the way they interact, and that a fix is possible. https://github.com/mobxjs/mobx-react-lite/issues/226#issuecomment-541752567

danielkcz commented 5 years ago

Please update to mobx-react@6.1.4 for the fix.

lock[bot] commented 4 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or questions.