Skip to content

feat: add replay subject - #50

Merged
dbrattli merged 1 commit into
mainfrom
feat/replay-subject-modern
Oct 17, 2026
Merged

dbrattli merged 1 commit into
mainfrom
feat/replay-subject-modern

Conversation

@dbrattli

Copy link
Copy Markdown
Collaborator

Adds Reactive.replaySubject bufferSize, adapted from @triandco's proposal in #10 to the current Fable.Actor and Reactive APIs.

The subject retains up to bufferSize recent values. A new subscriber receives those values in FIFO order before live values; a subscriber arriving after termination also receives the completion or error. A single actor owns subscribers, the buffer, and terminal state, so replay cannot interleave with live publication. Non-positive buffer sizes are rejected, and disposal removes a live subscriber.

The tests address the original review question: they wait for observer notifications with TestObserver.WaitUntil instead of fixed sleeps. OnNextAsync acknowledges after the actor updates the retained buffer, so a subsequent subscription has a deterministic replay snapshot.

Existing subject APIs and runtime behavior are unchanged. The implementation is covered on .NET, JavaScript, Python, and BEAM.

Adapt the replay subject proposed in #10 to the current actor-owned subject API. Preserve bounded FIFO replay and terminal notifications for late subscribers, and cover delivery without fixed sleeps.

Original proposal: triandco/AsyncRx#10
@dbrattli dbrattli mentioned this pull request Oct 17, 2026
@dbrattli
dbrattli merged commit 8314bf2 into main Oct 17, 2026
5 checks passed
@dbrattli
dbrattli deleted the feat/replay-subject-modern branch October 17, 2026 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant