statelyai / xstate

Actor-based state management & orchestration for complex app logic.
https://stately.ai/docs
MIT License
27.21k stars 1.26k forks source link

Bug: Sending an event with unserializable data to stopped actor throws an error (in development) #5013

Open sadn1ck opened 3 months ago

sadn1ck commented 3 months ago

XState version

XState version 5

Description

Hey folks! Have made a repro which has all these details -

Essentially -

Sending event to a stopped actor

https://github.com/statelyai/xstate/blob/51d4c4fc5bd303a00a554534956d8b994ea82e99/packages/core/src/createActor.ts#L657-L671

Expected result

I expect to not throw.

Actual result

An error was thrown for unserializable data.

Reproduction

https://stackblitz.com/edit/vitejs-vite-pl8fht?file=src%2Fmain.ts&terminal=dev

image

Additional context

Let me know if the repro is not clear! Thanks for all your work!