Pattern: Data Fetching
Pattern: Data Fetching & Async Flows
Model async data fetching, retry, cancellation, and cache states.
Overview
Data fetching is a perfect fit for state machines: idle → loading → success / error, with retry, refresh, and cancellation as transitions.
Key Concepts
States: idle → loading → success / error / empty
Guard: canRefresh, canRetry
Context for response data and error info
Cancellation via abort signal
Related Pages
Data Fetching → Forms — Form submissions as async flows
Data Fetching → Navigation — Route-based data loading
Tooling: Testing — Testing async machines
Case Study: Document Editor — Real-world async flow
TODO
Add retry with exponential backoff machine
Add caching machine
Add polling machine
Do you like what you are reading? Subscribe to receive updates.
Unsubscribe anytime
Powered by Seed HypermediaOpen App