Skip to content

Commit 2bb503e

Browse files
christianalfonigitbook-bot
authored andcommitted
GitBook: [master] one page modified
1 parent 5d24680 commit 2bb503e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/defining-state.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ export const logout = async ({ state, effects }) => {
419419
There are two important rules for predictable transitions:
420420

421421
1. The transition should always be **returned**
422-
2. A transition can either run **async** OR **mutate**, not both
422+
2. Only **synchronous** transitions can mutate the state
423423
{% endhint %}
424424

425425
What is important to realize here is that our logic is separated into **allowable** transitions. That means when we are waiting for the user on **line 4** and some other logic has changed the state to **unauthenticated** in the meantime, the user will not be set, as the **authenticated** transition is now not possible. This is what state machines do. They group logic into states that are allowed to run, preventing invalid logic to run.

0 commit comments

Comments
 (0)