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
When combining the target property in your event with the sendTo action, you're unable to send an event to your local state actor.
On my machine, I want to first clear all of my callbacks/subscriptions and then transition to another state. However, when I try to achieve this, I get the following error: Unable to send event to actor 'ACTOR_NAME' from machine 'MACHINE_NAME'.
Xstate searches for actors in children array which is empty (it is only empty when event has target property) targetActorRef = snapshot.children[resolvedTarget.slice(2)];
As a workaround, I can use the raise action to trigger another event that only performs the state transition. Why doesn't the original approach work?
XState version
XState version 5
Description
When combining the target property in your event with the sendTo action, you're unable to send an event to your local state actor.
On my machine, I want to first clear all of my callbacks/subscriptions and then transition to another state. However, when I try to achieve this, I get the following error:
Unable to send event to actor 'ACTOR_NAME' from machine 'MACHINE_NAME'.
Here is the section of my machine
Xstate searches for actors in children array which is empty (it is only empty when event has target property)
targetActorRef = snapshot.children[resolvedTarget.slice(2)];
As a workaround, I can use the raise action to trigger another event that only performs the state transition. Why doesn't the original approach work?
Expected result
My event can communicate with a local actor
Actual result
SendTo doesn't see a local actor
Reproduction
https://stackblitz.com/edit/github-ntq4he-jy7jad?file=src%2FfeedbackMachine.ts
Additional context
No response
The text was updated successfully, but these errors were encountered: