~/talk

A UI in All Its States with XState

TalkinFrenchat Devoxx France 2021 · 2021-09-29..10-01· [javascript, frontend-architecture]
github:rbung
slides:none on file

A refactor of a payment form replaces scattered boolean flags with an XState statechart (states: updating, processing, success, error) implemented in React and TypeScript, using XState Visualizer and inspect devtools. The machine uses guards, assign, and invoked services to call a payment API and ensures the API is invoked only once per submit (preventing four duplicate calls). The state machine is also used to generate model-based Cypress tests which are executed against the app.

AI-written summary · about

  1. 0:00Introduction
  2. 2:27State machines vs Statecharts
  3. 6:45Demo: Initial code issues
  4. 10:14Refactoring with XState
  5. 17:24Visualization and testing
  6. 19:09Integration in React
  7. 24:15Live inspection
  8. 26:04Automated test generation
  9. 28:31Future evolutions and conclusion
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.