block state updates while command is in flight
- Dominant language
- TypeScript
- Stars
- 8
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
Currently the user needs to defend against getting an unrelated state update originating from a network event immediately after invoking a command:
```typescript
let thingDone = false
for await (const state of machine) {
if (state.is(SomeState) && !thingDonw) {
state.cast().commands()?.doTheThing()
thingDone = true
}
}
```
It would be nicer and more intuitive if the next loop iteration was guaranteed to contain the information that was published via the `doTheThing` action (which usually will be reflected in transitioning to a new state, but might also just add something to the current state).
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing the async iteration shown in the issue, especially the `for await (const state of machine)` loop and the `doTheThing` command. Determine where command publication and subsequent state delivery are coordinated. Done means the next loop iteration reliably includes the command's published information without requiring the caller's `thingDone` guard.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100