Core 1.0.0-rc.1
Controls And Out-of-Band Mutations
Source file: packages/core/src/journey-machine/controls.ts
This file owns the mutations that are intentionally not part of transition matching.
That includes machine reset, direct context updates, clearing async errors, and final disposal.
How It Works
resetJourney()cancels in-flight queued work, rebuilds a clean snapshot from the initial step and initial context, syncs the async controller to that new async object, and writes the snapshot with reason"reset".updateContext(...)applies an updater to the current context and commits the result with reason"context". No transition selection happens here.updateContext(...)runs through the runtime queue so it applies after earlier queued work and rebases against the latest committed snapshot when it executes.clearStepError(...)delegates to the async-state controller so the error reset logic stays in one place.dispose()simply forwards toruntime.dispose(), which clears listeners and cancels queued work.
This split keeps the event pipeline honest. Transition-driven movement stays in send.ts and navigation.ts,
while maintenance operations stay here.
Recommended Reading
- Read createJourneyMachine to see where this controller is created and exposed on the public machine.
- Read Runtime Queue for snapshot commit behavior.
- Read Async State for the error and loading fields this file manipulates.
- Read Lifecycle and Snapshot for the public runtime effects of these mutations.