AsyncPipe doesn't register identical numbers as a change
See original GitHub issueš bug or intended?
Description
Hello everyone, Iām trying to figure out as to why my AsyncPipe is not exactly behaving like a basic subscription. I have an external subject to which I next numbers upon. This subject is given to a child-component through the Async pipe, which then displays whatever given in its template.
For this easy test case, I also want to reset that internal @Input()
of the child component whenever I want to, to 0. However, when I did reset that internal value to 0, and try to next another number ( the same number as I previously did ), the @Input()
setter does not pick up any change coming from the Async subscribed subject. Iām guessing the Async-pipe has some logic built in that covers duplicates? Although, I would think that it would act the same as a subscription on that Subject, because a normal subscription does log every entry, even identical ones.
Unsure if this is a bug, or just something that is intended.
Iāve read the documentation and it only says that When a new value is emitted, the async pipe marks the component to be checked for changes.
, but I was thinking it is mentioning that for the change detection itself?
Or is the AsyncPipe simply built to only act whenever the value has changed from the previous one,
as sending through objects always triggers it?
Any help is highly appreciated.
š¬ Minimal Reproduction
Iāve created a StackBlitz, just click on the first button to next 200 for the first time, then click the second button to reset it internally in the child component and then try to do another next of 200.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
Hi @santoshyadav198613, thanks for your reply. I guess that thatās the issue tho, what if Iām building a library and for the sake of convenience do not want the user that is using the hellocomponent from library to have to manually send a next on its subject to reset it, but rather handle it inside the library component. Seems like a valid usecase, no ?
Relates to https://github.com/angular/angular/issues/29927