Closed crimson-med closed 1 year ago
Discussed and we have a session with @christianalfoni on Monday to research and implement a plan
Thank you. I was having this problem as well
Hm, seems it's related to #567 @christianalfoni @grandevel @MaxSpiro Did you guys have a chance to look into this?
I'm a bit confused on this ticket: is overmindjs
not compatible with React 18
or this is only a problem for strict version of React 18
. We are updating our react-native
app and we used and β€οΈ loved overmindjs
and we want to keep the lib. (I hate the idea of going back to some pseudo FP clunky lib like zustand
).
Hi there π
React 18 support was shipped with the latest version, though I was not personally able to refactor any existing app to React 18, so could not personally verify. But it is a "either it works or does not" kind of thing π π
Thanks a lot for the clarification @christianalfoni!
I'm experiencing stale UI values in parts of my application that's running in StrictMode
, so it looks like the React 18 support isn't 100% fault free @christianalfoni. The same values are up-to-date when removing StrictMode
, so it looks to be a "strict mode only" bug.
Environment:
"overmind": "28.0.2",
"overmind-react": "29.0.2",
"react": "18.2.0",
Hi @larrifax π
Thanks for reporting, I created a PR which I believe fixes the issue: https://github.com/cerebral/overmind/pull/586
The issue is indeed related to StrictMode
and Reacts "double render checks" to detect bad side effects. Overmind has a "controlled bad side effect" to more efficiently clean up memory usage, but this breaks in development and the previous "development fix" seems to be too fragile.
I'll let you know when it is merged to @next
and I hope you are able to test to verify that it works as I have not been able to reproduce the original issue with simple examples π
@larrifax If you are eager to test you can copy the OvermindReact
code from this Sandbox and create your hooks from that file instead π : https://codesandbox.io/p/sandbox/little-hooks-3p998f?file=%2Fsrc%2FOvermindReact.ts
Okay, so with help from @henri-hulski we have a pretty smooth deploy process now and the PR is already merged and available on @next
. So install all packages of overmind
using the @next
tag, like npm install overmind@next
, but also for overmind-react
etc. π
I will take the devtool and target it for an upgrade to React 18 to properly verify these changes, but it was quicker to do a theoretical change now π
Thanks for the swift response!
I've upgraded my project to the latest @next
tag, and it seems to have fixed the bug I was encountering. I'll keep using it until you cut a new release. Will report back if I notice any oddities with it. π
Should be solved in #586. Please reopen if there's still a problem.
Per discussion in the discord we discovered that the latest versions is incompatible with React 18.X Strict Mode
Here is a repo showcasing the example:
https://github.com/crimson-med/state-issue/tree/overmind
Quote from DavidTheUnwise from discord
Link to the call: https://github.com/cerebral/overmind/blob/next/packages/overmind-react/src/index.ts#L161