Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .changeset/fluent-transition-handlers.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
Replace `Machine.transition(...)` with fluent transition selectors supplied directly to inline handlers. Select a target and optionally attach its resolver, reentry, or named branches without an intermediate wrapper:

```ts
Start: ;
;((to) => to.full.Running().resolve(({ event, target }) => target.from({ count: event.count })))
const handlers = {
Start: (to) => to.full.Running().resolve(({ event, target }) => target.from({ count: event.count })),

Route: ;
;((to) =>
to.branches({
running: { target: to.full.Running() },
done: { target: to.full.Done() },
unchanged: { target: to.none() }
}).resolve(({ event, select }) => event.cached ? select.done.from() : select.running.from()))
Route: (to) =>
to.branches({
running: { target: to.full.Running() },
done: { target: to.full.Done() },
unchanged: { target: to.none() }
}).resolve(({ event, select }) => event.cached ? select.done.from() : select.running.from())
}
```

Use `.reenter()` for resolver-free reentry, or pass literal `declinable: true` to `.resolve(...)` when the resolver must receive `decline()`. Bare targets are accepted only when their schemas support default construction.
Expand Down