-
Notifications
You must be signed in to change notification settings - Fork 10
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
serialize control state #8
Comments
Hi @sytabaresa Thanks for your question. I do not completely understand it though. Can you elaborate a bit more on your use case server side? A Kingly state machine is a function produced by a factory from a machine definition. So:
I assume you want to save a machine in any state, not necessarily the initial state. Is that correct? If that is correct, then in this version of the library it is not possible to do that. It would however be easy for me to add an API that revolves around a pure function such as: In that new |
Sebastian, if you pull from the master, you should find a new version which exposes a createPureStateMachine factory with the same parameters as createStateMachine. That factory however returns a function
Let me know if that works and I can go ahead making a release and documenting it properly. That should cover all the cases I can think about: you can restart from the beginning (option 2), you can continue (option 1), you can continue from a saved point (option 3). You don't need to know what is in |
@sytabaresa I pushed a fix in master that makes sure that the object containing the history state is not mutated. Now that it is no longer internal, not doing so could lead to further calls for |
@sytabaresa no answers so closing this. Feel free to reopen if there is anything new related to this. The feature will remain in the distribution. I haveen't decided yet if and when it will be documented. It should however be replicated by the slim state machine compiler so it is also available for compiled machines. |
Nevermind, with the new versions, I see that I can do that with |
Hi, i have a question, How a control state_ of a machine can be serialized without breaking Kingly architectural model?
I want to use Kingly in Nodejs server side and I need to load/deserialize the control state and extended state of a user session, make a transition and then unload/serialize that user state/session in a session storage, like Redis.
I know is possible in the case of extended state using the update function and initialExtendedState. but how about control state?
The text was updated successfully, but these errors were encountered: