Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation of refCount is wrong #5587

Open
1 of 5 tasks
kuroneko0441 opened this issue Jul 12, 2020 · 5 comments
Open
1 of 5 tasks

Documentation of refCount is wrong #5587

kuroneko0441 opened this issue Jul 12, 2020 · 5 comments
Labels
docs Issues and PRs related to documentation

Comments

@kuroneko0441
Copy link

kuroneko0441 commented Jul 12, 2020

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?

@cartant
Copy link
Collaborator

cartant commented Jul 14, 2020

Note that using the share operator is exactly the same as using the publish operator ... and the refCount operator in a sequence.

Yes. The above statement is incorrect.

@cartant cartant added the docs Issues and PRs related to documentation label Jul 14, 2020
@kuroneko0441
Copy link
Author

Is it just a documentation error? Or an implementation error?

@cartant
Copy link
Collaborator

cartant commented Jul 16, 2020

The statement in the docs is wrong. It's by design that publish and share have differing restart behaviours.

@ptouchton
Copy link

I am a complete newbie to opensource contributions but, I would like to begin. Is this change as simple as removing the snippet about the share operator?

@cartant
Copy link
Collaborator

cartant commented Jul 24, 2020

@ptouchton

Is this change as simple as removing the snippet about the share operator?

In the docs, AFAICT, there is no snippet that mentions share. All that needs to be done is to remove this sentence, as it is not correct:

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.

Beyond that, I don't think changes would be worthwhile - your time would be better spent look to contribute to other issues - as these APIs are likely to change very soon. Really, refCount should not be an operator. Meanwhile, I'd be happy to merge a PR that simply removes the incorrect sentence.

Note that the docs are generated from the TSDoc, so the change needs to be made here:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Issues and PRs related to documentation
Projects
None yet
Development

No branches or pull requests

3 participants