fix(core): Multiple subscribers to ApplicationRef.isStable should all…#53541
Closed
atscott wants to merge 1 commit intoangular:mainfrom
Closed
fix(core): Multiple subscribers to ApplicationRef.isStable should all…#53541atscott wants to merge 1 commit intoangular:mainfrom
atscott wants to merge 1 commit intoangular:mainfrom
Conversation
… see values The behavior of `ApplicationRef.isStable` changed in 16.1 due to angular@28c68f7. This change added a `share` to the `isStable` observable, which prevents additional subscribers from getting a value until a new one emits. One solution to the problem would be `shareReplay(1)`. However, that would increase the bundle size since we do not use `shareReplay` elsewhere. Instead, we don't even really need to share the observable. The `Observable` available in `ApplicationRef.isStable` before the above commit was the zone stable observable, without a `share`. The new behavior adds only an additional observable to the stream, `hasPendingTasks` (a `BehaviorSubject`). The observables in this stream are not expensive to subscribe to. The only one with side effects is the `isStable` (because it subscribes to onStable), but that one already has the `share` operator on it. Omitting the `share` in `ApplicationRef` also means that applications on `zoneless` will not have to pay the cost of the operator when we make zones optional because the zone stable observable is the only place we use it.
AndrewKushnir
approved these changes
Dec 13, 2023
Contributor
AndrewKushnir
left a comment
There was a problem hiding this comment.
@atscott thanks for the fix! 👍
alxhub
approved these changes
Dec 13, 2023
alan-agius4
approved these changes
Dec 13, 2023
Contributor
alan-agius4
left a comment
There was a problem hiding this comment.
LGTM.
Initially the share was there to have a single source of truth when having multiple subscriptions to isStable.
Member
|
This PR was merged into the repository by commit 629343f. |
alxhub
pushed a commit
that referenced
this pull request
Dec 13, 2023
… see values (#53541) The behavior of `ApplicationRef.isStable` changed in 16.1 due to 28c68f7. This change added a `share` to the `isStable` observable, which prevents additional subscribers from getting a value until a new one emits. One solution to the problem would be `shareReplay(1)`. However, that would increase the bundle size since we do not use `shareReplay` elsewhere. Instead, we don't even really need to share the observable. The `Observable` available in `ApplicationRef.isStable` before the above commit was the zone stable observable, without a `share`. The new behavior adds only an additional observable to the stream, `hasPendingTasks` (a `BehaviorSubject`). The observables in this stream are not expensive to subscribe to. The only one with side effects is the `isStable` (because it subscribes to onStable), but that one already has the `share` operator on it. Omitting the `share` in `ApplicationRef` also means that applications on `zoneless` will not have to pay the cost of the operator when we make zones optional because the zone stable observable is the only place we use it. PR Close #53541
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
ChellappanRajan
pushed a commit
to ChellappanRajan/angular
that referenced
this pull request
Jan 23, 2024
… see values (angular#53541) The behavior of `ApplicationRef.isStable` changed in 16.1 due to angular@28c68f7. This change added a `share` to the `isStable` observable, which prevents additional subscribers from getting a value until a new one emits. One solution to the problem would be `shareReplay(1)`. However, that would increase the bundle size since we do not use `shareReplay` elsewhere. Instead, we don't even really need to share the observable. The `Observable` available in `ApplicationRef.isStable` before the above commit was the zone stable observable, without a `share`. The new behavior adds only an additional observable to the stream, `hasPendingTasks` (a `BehaviorSubject`). The observables in this stream are not expensive to subscribe to. The only one with side effects is the `isStable` (because it subscribes to onStable), but that one already has the `share` operator on it. Omitting the `share` in `ApplicationRef` also means that applications on `zoneless` will not have to pay the cost of the operator when we make zones optional because the zone stable observable is the only place we use it. PR Close angular#53541
rlmestre
pushed a commit
to rlmestre/angular
that referenced
this pull request
Jan 26, 2024
… see values (angular#53541) The behavior of `ApplicationRef.isStable` changed in 16.1 due to angular@28c68f7. This change added a `share` to the `isStable` observable, which prevents additional subscribers from getting a value until a new one emits. One solution to the problem would be `shareReplay(1)`. However, that would increase the bundle size since we do not use `shareReplay` elsewhere. Instead, we don't even really need to share the observable. The `Observable` available in `ApplicationRef.isStable` before the above commit was the zone stable observable, without a `share`. The new behavior adds only an additional observable to the stream, `hasPendingTasks` (a `BehaviorSubject`). The observables in this stream are not expensive to subscribe to. The only one with side effects is the `isStable` (because it subscribes to onStable), but that one already has the `share` operator on it. Omitting the `share` in `ApplicationRef` also means that applications on `zoneless` will not have to pay the cost of the operator when we make zones optional because the zone stable observable is the only place we use it. PR Close angular#53541
amilamen
pushed a commit
to amilamen/angular
that referenced
this pull request
Jan 26, 2024
… see values (angular#53541) The behavior of `ApplicationRef.isStable` changed in 16.1 due to angular@28c68f7. This change added a `share` to the `isStable` observable, which prevents additional subscribers from getting a value until a new one emits. One solution to the problem would be `shareReplay(1)`. However, that would increase the bundle size since we do not use `shareReplay` elsewhere. Instead, we don't even really need to share the observable. The `Observable` available in `ApplicationRef.isStable` before the above commit was the zone stable observable, without a `share`. The new behavior adds only an additional observable to the stream, `hasPendingTasks` (a `BehaviorSubject`). The observables in this stream are not expensive to subscribe to. The only one with side effects is the `isStable` (because it subscribes to onStable), but that one already has the `share` operator on it. Omitting the `share` in `ApplicationRef` also means that applications on `zoneless` will not have to pay the cost of the operator when we make zones optional because the zone stable observable is the only place we use it. PR Close angular#53541
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
… see values
The behavior of
ApplicationRef.isStablechanged in 16.1 due to 28c68f7. This change added ashareto theisStableobservable, which prevents additional subscribers from getting a value until a new one emits. One solution to the problem would beshareReplay(1). However, that would increase the bundle size since we do not useshareReplayelsewhere. Instead, we don't even really need to share the observable.The
Observableavailable inApplicationRef.isStablebefore the above commit was the zone stable observable, without ashare. The new behavior adds only an additional observable to the stream,hasPendingTasks(aBehaviorSubject). The observables in this stream are not expensive to subscribe to. The only one with side effects is theisStable(because it subscirbes to onStable), but that one already has theshareoperator on it. Omitting theshareinApplicationRefalso means that applications onzonelesswill not have to pay the cost of the operator when we make zones optional because the zone stable observable is the only place we use it.