SP slotplate
Concept

State (MobX stores)

Observable domain state — the read surface for presenters.

slotplate uses MobX for state. One RootStore composes three domain stores:

  • BalanceStorebalance, bet, lastWin + actions.
  • DataStore — last server response: grid, winlines, totalWin, teasingReels.
  • UIStorespinEnabled, stopEnabled, spinning, speed.

Rules

  • Mutations go through @action methods only. No direct writes from outside.
  • Presenters observe via autorun or reaction.
  • Stores don't import from view/, presenters/, or flow/.
  • 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 (reaction with fireImmediately: 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.