Hi there, I made an experiment to test if a child spawn actor can restore nornal status after throwing an error, here is the process:
A parent actor creates a spawn actor:
childrenActorRef: ({ self, spawn }) => ({
}),
}),
And I manually throw an error in child1:
[SOME_EVENT]: {
// this will throw an js error
const a = undefined;
console.log(a.b);
}
}
And I can successfully subscribe the error by following the official doc
error: (err) => {
// can catch the error here
console.error(err);
// but this event will no longer be received by the child1 actor
child1Actor.send({ type: 'SOME_EVNET2' })
}
})
But the strange thing is the child1 actor seems has crashed and no longer be able to receive any events.
I don't know if it is a reasonable behavior as I haven't found related description in official docs about the behavior of an actor after throwing js error. But my understanding is: since I catch the error, the actor should still be working.
Expected result
Expected the child1 actor can still be alive and able to receive events normally even after throwing an js error
Actual result
the child1 actor seems has crashed and no longer be able to receive any events.
XState version
XState version 5
Description
Hi there, I made an experiment to test if a child spawn actor can restore nornal status after throwing an error, here is the process:
A parent actor creates a spawn actor:
And I manually throw an error in child1:
And I can successfully subscribe the error by following the official doc
But the strange thing is the child1 actor seems has crashed and no longer be able to receive any events.
I don't know if it is a reasonable behavior as I haven't found related description in official docs about the behavior of an actor after throwing js error. But my understanding is: since I catch the error, the actor should still be working.
Expected result
Expected the child1 actor can still be alive and able to receive events normally even after throwing an js error
Actual result
the child1 actor seems has crashed and no longer be able to receive any events.
Reproduction
https://codesandbox.io/p/devbox/github/statelyai/xstate/tree/main/templates/vanilla-ts
Additional context
No response