You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a bug that happens in specific conditions, component does not connect to overmind and does not react on state changes.
Background and problem
I updated overmind packages to the latest versions:
"overmind": "28.0.1",
"overmind-react": "29.0.1",
Migrated codebase according to the migration guide.
While testing I noticed that <Header /> component does not render icons after logging-in:
Icons:
In the devtools I see that <Header /> isn't connected even though I have useOvermindState and some state used inside render function:
The only functionality-relevant change is removing onInitialize and creating new action called onInitializeOvermind. After some digging I discovered conditions in which bug appear:
Setting boolean flag to false inside onInitializeOvermind
Accessing boolean flag in component via useOvermindState hook.
Codesandbox is the same code migrated according to the guide. Component does not connect to overmind (Toggle changes value in state but component doesn't care): https://codesandbox.io/s/overmind-connect-issue-60u5w
Expected behavior
I would expect the same behavior as in older version of overmind 27.0.0. Component should connect anyway, doesn't matter how I call actions (inside useEffect or in function component's body) and whether I change flag inside initializeOvermind.
I hope it helps. @christianalfoni Will you have a chance to look at it?
The text was updated successfully, but these errors were encountered:
Hello @christianalfoni
There is a bug that happens in specific conditions, component does not connect to overmind and does not react on state changes.
Background and problem
I updated overmind packages to the latest versions:
Migrated codebase according to the migration guide.
While testing I noticed that
<Header />
component does not render icons after logging-in:Icons:
In the devtools I see that
<Header />
isn't connected even though I haveuseOvermindState
and some state used inside render function:The only functionality-relevant change is removing
onInitialize
and creating new action calledonInitializeOvermind
. After some digging I discovered conditions in which bug appear:false
insideonInitializeOvermind
useOvermindState
hook.true
inside function component's body, e.gIn such case
Component1
won't connect to overmind and will ignore any changes tosomeBooleanValue
.Reproducible examples
CodeSandbox number one has an old version of overmind with
onInitialize
where everything is working as expected (PressToggle
to see changes): https://codesandbox.io/s/overmind-connect-issue-old-working-0jm9w?file=/src/FinishLoginOnMount.tsxCodesandbox is the same code migrated according to the guide. Component does not connect to overmind (
Toggle
changes value in state but component doesn't care): https://codesandbox.io/s/overmind-connect-issue-60u5wExpected behavior
I would expect the same behavior as in older version of overmind
27.0.0
. Component should connect anyway, doesn't matter how I call actions (inside useEffect or in function component's body) and whether I change flag inside initializeOvermind.I hope it helps. @christianalfoni Will you have a chance to look at it?
The text was updated successfully, but these errors were encountered: