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
In many scenarios you want to implement persistence to your flow but using the persistence feature of xstate doesn't apply. For example in a register -> login sort of flow, you'll want to check your database to see if your user exists and resume the flow at the login state, doesn't make sense to go around saving an xstate snapshot for cases like these
Workarounds
Currently this logic is able to be implemented manually but its truly a pain to do so, requiring you to create a dummy starting state and mapping out every possible transition from this starting state to any resumable state. Which also renders the flowchart of your machine unusable
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Just like context can be created dynamically based on the machine's input:
Allow something similar for determining the initial state of the machine, for example:
Example use case:
In many scenarios you want to implement persistence to your flow but using the persistence feature of xstate doesn't apply. For example in a register -> login sort of flow, you'll want to check your database to see if your user exists and resume the flow at the
login
state, doesn't make sense to go around saving an xstate snapshot for cases like theseWorkarounds
Currently this logic is able to be implemented manually but its truly a pain to do so, requiring you to create a dummy
starting
state and mapping out every possible transition from thisstarting
state to any resumable state. Which also renders the flowchart of your machine unusableBeta Was this translation helpful? Give feedback.
All reactions