I am contemplating idea of making my own state machine lib to handle deep states situation, but really don't want to make another wheel :)
Is there a way, or plans or interest in making deep states possible? Quite often when dealing with complex UI you might benefit from having of more than just one level of states. Something like:
authenticated
dashboard
overview
users
sales
unauthenticated
authenticate
login
register
retrieve password
Key here is that _onEnter and _onExit will be called on each parent too when necessary. I.e. if my current state is unauthenticated.authenticate.login and after successful authentication application state switches to authenticated.dashboard.overview following calls should fire:
unauthenticated.authenticate.login._onExit();
unauthenticated.authenticate._onExit();
unauthenticated._onExit();
authenticated._onEnter();
authenticated.dashboard._onEnter();
authenticated.dashboard.overview._onEnter();
But most importantly, if later state changed to authenticated.dashboard.users, only following calls should be made:
authenticated.dashboard.overview._onExit();
authenticated.dashboard.users._onEnter();
Why this is important? Quite often your frontend app need to use multiple templates inside each other. And tracking which template currently shown on the screen and should I load and display new one is tricky. Another approach is to render each page from top-level, but this is wasteful. Therefore I am looking for more tree-like state machine solution.
I am contemplating idea of making my own state machine lib to handle deep states situation, but really don't want to make another wheel :)
Is there a way, or plans or interest in making deep states possible? Quite often when dealing with complex UI you might benefit from having of more than just one level of states. Something like:
Key here is that
_onEnter
and_onExit
will be called on each parent too when necessary. I.e. if my current state isunauthenticated.authenticate.login
and after successful authentication application state switches toauthenticated.dashboard.overview
following calls should fire:But most importantly, if later state changed to
authenticated.dashboard.users
, only following calls should be made:Why this is important? Quite often your frontend app need to use multiple templates inside each other. And tracking which template currently shown on the screen and should I load and display new one is tricky. Another approach is to render each page from top-level, but this is wasteful. Therefore I am looking for more tree-like state machine solution.
hope all of this make sense ;)