Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat(core): Add rxjs operator prevent app stability until an event #56533

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

Closed
wants to merge 1 commit into from

Conversation

atscott
Copy link
Contributor

@atscott atscott commented Jun 20, 2024

This commit adds an operator to help rxjs observables important for rendering keep the application unstable (and prevent serialization) until there is an event (observable emits, completes, or errors, or the subscription is unsubscribed). This helps with SSR for zoneless and also helps for when operations are intentionally executed outside the Angular Zone but are still important for SSR (i.e. angularfire and the zoneWrap helper hacks).

@atscott atscott added area: core Issues related to the framework runtime core: rxjs interop core: zoneless Issues related to running Angular without zone.js labels Jun 20, 2024
@ngbot ngbot bot added this to the Backlog milestone Jun 20, 2024
@atscott atscott requested a review from alxhub June 20, 2024 20:07
@angular-robot angular-robot bot added the detected: feature PR contains a feature commit label Jun 20, 2024
@atscott atscott force-pushed the pendingUntilEmit branch from ab923f9 to 623b0d5 Compare June 20, 2024 20:16
@atscott atscott added the target: minor This PR is targeted for the next minor release label Jun 20, 2024
*
* @experimental
*/
export function pendingUntilEvent<T>(injector?: Injector): MonoTypeOperatorFunction<T> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if an app never stabilizes (because of some bug)? This will never complete I guess? Should we offer a timeout for this one, or just document it for the devs to keep that in mind too?

Copy link
Contributor Author

@atscott atscott Jun 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming you mean what happens when no event (emit, error, unsubscribe, or complete) occurs in the subscription? This operator affects stability rather than app stability affecting the task completion.

I don't believe a timeout is something that should be configured in this operator. If a timeout for the task is desirable, that can be done in a different operator, i.e. the builtin timeout.

edit to clarify: Leaving this open because I do think this is a reasonable request and worth considering.

@angular-robot angular-robot bot added area: core Issues related to the framework runtime and removed area: core Issues related to the framework runtime labels Oct 22, 2024
This commit adds an operator to help rxjs observables important for rendering
keep the application unstable (and prevent serialization) until there is
an event (observable emits, completes, or errors, or the subscription is
unsubscribed). This helps with SSR for zoneless and also helps for when
operations are intentionally executed outside the Angular Zone but are
still important for SSR (i.e. angularfire and the zoneWrap helper hacks).
@angular-robot angular-robot bot added area: core Issues related to the framework runtime and removed area: core Issues related to the framework runtime labels Oct 22, 2024
@ngbot ngbot bot modified the milestone: Backlog Oct 22, 2024
@e-oz
Copy link

e-oz commented Oct 22, 2024

I guess it can only happen if the “async” pipe is being used in the template (instead of a signal).

Please let me know if I’m wrong.

@alxhub alxhub added action: merge The PR is ready for merge by the caretaker merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note labels Oct 22, 2024
@alxhub
Copy link
Member

alxhub commented Oct 22, 2024

Caretaker: PR is "green" in g3.

@pullapprove pullapprove bot requested a review from AndrewKushnir October 22, 2024 20:44
Copy link
Contributor

@AndrewKushnir AndrewKushnir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed-for: public-api

Copy link
Member

@alxhub alxhub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed-for: public-api

@AndrewKushnir
Copy link
Contributor

This PR was merged into the repository by commit 8ebbae8.

The changes were merged into the following branches: main

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Nov 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: core Issues related to the framework runtime core: rxjs interop core: zoneless Issues related to running Angular without zone.js detected: feature PR contains a feature commit merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants