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
On <StrictMode> the re-render is causing the reference returned by system.get to be undefined on the body of a fromCallback logic function:
Expected result
On <StrictMode> , system.get('feedback') should consistently return a reference to the feedbackActor instead of undefined
Actual result
If the machine spawning the reference is not the machine being accessed by system.get.
In this scenario I got 3 actors:
root (machine)
alert (fromCallback)
feedback (machine)
If root spawns both actors then whenever alert function callback is called the second time (due to <StrictMode> re-rendering) then system.get('feedback') will return undefined ❌, while system.get('root') returns the actor reference ✅.
If root spawns feedback and feedback spawns alert then the problem is solved. ✅
XState version
XState version 5
Description
Here's a repro: https://stackblitz.com/edit/github-4nrvzx?file=src%2FfeedbackMachine.ts
On
<StrictMode>
the re-render is causing the reference returned bysystem.get
to be undefined on the body of afromCallback
logic function:Expected result
On
<StrictMode>
,system.get('feedback')
should consistently return a reference to thefeedbackActor
instead ofundefined
Actual result
If the machine spawning the reference is not the machine being accessed by
system.get
.In this scenario I got 3 actors:
If root spawns both actors then whenever alert function callback is called the second time (due to
<StrictMode>
re-rendering) thensystem.get('feedback')
will returnundefined
❌, whilesystem.get('root')
returns the actor reference ✅.If root spawns feedback and feedback spawns alert then the problem is solved. ✅
Reproduction
https://stackblitz.com/edit/github-4nrvzx?file=src%2FfeedbackMachine.ts
Additional context
No response
The text was updated successfully, but these errors were encountered: