Conversation
🦋 Changeset detectedLatest commit: b2672fa The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| // Yield the initial snapshot if the actor is already running | ||
| if (this._processingStatus === ProcessingStatus.Running) { | ||
| yield this.getSnapshot(); | ||
| } |
There was a problem hiding this comment.
does this match the behavior of vanilla actorRef.subscribe?
| } | ||
|
|
||
| while (this._processingStatus !== ProcessingStatus.Stopped) { | ||
| yield await new Promise<SnapshotFrom<TLogic>>((resolve, reject) => { |
There was a problem hiding this comment.
This implementation is neat but I think we should do better in the library context. This resubscribes with each iteration step. It would be better to maintain a single subscription throughout the full lifecycle of the iteration.
| expect(snapshots[2].status).toBe('done'); | ||
| }); | ||
|
|
||
| it('should handle errors in async iteration', async () => { |
There was a problem hiding this comment.
this doesn't test what it claims - this just happens to use events and states named with "error" but in reality this machine completes gracefully through a regular final state
Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
Make actors async iterable: