Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Run async stuff outside Angular#196

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
arturovt wants to merge1 commit intomicrosoft:main
base:main
Choose a base branch
Loading
fromarturovt:run-outside-angular

Conversation

arturovt
Copy link

This commit wraps the tracking functionality to run outside of the Angular zone. Previously, it hindered server-side rendering and hydration, causing instability in the app. The app achieves stability when no microtasks or macrotasks are running.

On the client side, this change also prevents unnecessary view updates when asynchronous tasks are set up bytrackPageView.

This commit wraps the tracking functionality to run outside of the Angular zone. Previously, it hinderedserver-side rendering and hydration, causing instability in the app. The app achieves stability when nomicrotasks or macrotasks are running.On the client side, this change also prevents unnecessary view updates when asynchronous tasks are setup by `trackPageView`.
@@ -186,7 +187,7 @@ export class AngularPlugin extends BaseTelemetryPlugin {
* @param event The event that needs to be processed
*/
processTelemetry(event: ITelemetryItem, itemCtx?: IProcessTelemetryContext) {
this.processNext(event, itemCtx);
runOutsideAngular(() =>this.processNext(event, itemCtx));
Copy link
Contributor

Choose a reason for hiding this comment

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

This one is likely not needed as this is called internally from all of thetrackXXX calls -- so (if I'm following your comments correctly) this should already be getting run in the "outside" context...

Although, I do concede that if something does end up calling a track call within the Angular context (like any of the automatic events (JS errors, URL change etc)) then this would be the point at which it would switch to the different async context.

My only concern with this (which is less of an issue with any SPA framework) is that once the page starts to unload all operation "should" become synchronous to avoid the loss of events. And I don't think we current expose the internal flags indicating that we have received any unload signal (unload, beforeunload, pagehide and visibilitychange events)

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@MSNevMSNevMSNev left review comments

@Karlie-777Karlie-777Awaiting requested review from Karlie-777

@siyuniu-mssiyuniu-msAwaiting requested review from siyuniu-ms

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@arturovt@MSNev

[8]ページ先頭

©2009-2025 Movatter.jp