Concept
State (MobX stores)
Observable domain state — the read surface for presenters.
slotplate uses MobX for state. One RootStore composes three domain stores:
BalanceStore—balance,bet,lastWin+ actions.DataStore— last server response:grid,winlines,totalWin,teasingReels.UIStore—spinEnabled,stopEnabled,spinning,speed.
Rules
- Mutations go through
@actionmethods only. No direct writes from outside. - Presenters observe via
autorunorreaction. - Stores don't import from
view/,presenters/, orflow/. - Stores don't call each other's actions. A phase orchestrates cross-store changes.
Why MobX
The alternatives that come up: Redux, Zustand, signals, raw React state. For slot games:
- Redux is overkill — the ceremony tax shows up in every diff, and slot state is small enough that you don't benefit from time-travel debugging outside dev tools.
- Zustand is fine — the deciding factor for MobX was the cleaner story for cross-cutting reactions (
reactionwithfireImmediately: false). - Signals are promising but ecosystem maturity isn't there yet for this kind of app.
- React state alone doesn't work because the Pixi view isn't in React's tree.