Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for :type :final state #12

Open
ikitommi opened this issue Apr 13, 2022 · 2 comments
Open

support for :type :final state #12

ikitommi opened this issue Apr 13, 2022 · 2 comments

Comments

@ikitommi
Copy link

would be good to know if the process is done. Currently just :parallel is supported as :type in the Schema + would be good to not to allow signals after :final state has reached.

https://xstate.js.org/docs/guides/final.html#api

@lucywang000
Copy link
Owner

I'm always curious about the "final state" feature. Could you name a typical use case for that in real world applications?

@ikitommi
Copy link
Author

Sure.

in real life: I've used FSMs to model long-running processes (with both users and applications sending signals to them), with state stored in a database. These processes need to have start and end after which, after end, special bookkeeping is done (compliancy, reporting + hitting filter "done").

Simple case not from real world:

  • there are two end states: :cancelled (unhappy) and :closed(happy). After reaching either, the machine doesn't accept any more signals.
  • it's not enough not to put any transitions into the "final" state as there can be top-level signals that should not be accepted anymore, sample https://stately.ai/viz/5ed2fa0c-a585-4695-b6b9-c81789274756

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants