MicheleBertoli/react-automata

Initialising a machine with a different initial state is inert

ferdinandsalis opened this issue · 5 comments

Currently when you want to initialise a Machine with a different state than specified in the statechart the resulting state is inert and might lack necessary information to be useful to render an ui. That is actions and history (maybe more in the future eg. data).

Might it be better to able to pass a state object such as from new State(stateValue, history?, actions?) to the withStatechart decorated component?

My use case is as stated in this issue statelyai/xstate#31.

I guess this also necessitates that one is able to get the current State object. However currently you can only get the StateValue.

Thank you very much, @ferdinandsalis.
I left a comment on the PR.

I guess this also necessitates that one is able to get the current State object. However currently you can only get the StateValue.

100% agree, I also need to change this behaviour for a component I'm working on.
I'll push an update very soon.

Here we go: 895b4fc :)

@MicheleBertoli awesome just what I needed ☺️

Merged #31 🙌
Thank you very much, @ferdinandsalis.