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
Nice catch. I believe the docs are wrong here.
I think a stateGuard always has the current machine state. Only when the guard evaluates to true, the transition can be taken. Therefore, the state in a guard should always be the one before the transition.
Description
In the Guards documentation section, the 3rd argument has misleading descriptions:
https://xstate.js.org/docs/guides/guards.html#guards-condition-functions
https://xstate.js.org/docs/guides/guards.html#serializing-guards
Is the
state
property the machine state after or before transition?Or is this the different between nonserialized and serialized guard functions?
Whichever the answer is I believe the documentation should clarify.
The text was updated successfully, but these errors were encountered: