Async subject and ReplaySubject still accept next messages
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 31.7k
- Forks
- 3k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
Both AsyncSubject and ReplaySubject overrides Subject next method,
but even _throwIfClosed checked in every error/next/complete messages, is not checked in these two overriden methods.
It just check whether stopped or not, but not checked whether closed or not
of course it is checked by calling super.next() method but
if I manually set closed flag to true, the Subject become closed but not isStopped then
the buffer in ReplaySubject and _value in the AsynSubject effected with this value
next(value){
if (!isStopped) {
_buffer.push(value);
...
}
this._trimBuffer();
super.next(value)
}
Expected behavior
if a Subject closed, none of the message receieved/transmitted
here the message receieved updates the buffer/last value shouldn't this too
Reproduction code
Reproduction URL
No response
Version
7.8.2
Environment
No response
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the AsyncSubject and ReplaySubject next overrides, then compare their closed-state handling with Subject.next. Add regression coverage showing that a closed subject does not update the ReplaySubject buffer or AsyncSubject value, and run the relevant RxJS test suite to verify the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100