ReactiveX / ReactiveX/rxjs

Documentation of `refCount` is wrong

Open
#5,587 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

docs
Dominant language
TypeScript
Stars
31.7k
Forks
3k
PR merge metrics
No merged PRs in 30d

Description

Documentation Related To Component:

refCount

Please check those that apply
  • typo
  • documentation doesn't exist
  • documentation needs clarification
  • error(s) in example
  • needs example
Description Of The Issue

Documentation in refCount says:

Note that using the share operator is exactly the same as using the publish operator (making the observable hot) and the refCount operator in a sequence.

But I think it`s not "exactly same".

If I subscribe an observable that already completed, observable with publish & refCount won`t restart.

But the completed observable with share will restart.

I`m not sure which is wrong: doc or real code.

Test Case(StackBlitz)

======EDIT======

I think I found an alias for publish and share

publish()
/* is equivalent to */
multicast(new Subject()) // Subject Object
share()
/* is equivalent to */
multicast(() => new Subject()),  // Subject Factory
refCount()

Maybe it could be some hint?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked refCount documentation and reproduce the behavior in the linked StackBlitz index.ts example. Compare the documented relationship between share, publish, and refCount with the observed behavior after completion; the work is done when the documentation accurately describes the distinction or the example is corrected.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.