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

fix(angular): call showReportDialog in root context #11703

Merged
merged 1 commit into from
Apr 25, 2024

Conversation

arturovt
Copy link
Contributor

@arturovt arturovt commented Apr 19, 2024

This commit calls showReportDialog outside of the Angular context to prevent
unnecessary view updates when asynchronous tasks are set up within the showReportDialog function.

@@ -3,5 +3,8 @@ module.exports = {
browser: true,
},
extends: ['../../.eslintrc.js'],
rules: {
'@sentry-internal/sdk/no-optional-chaining': 'off',
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed it.

Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

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

Hey, thanks for opening this PR! In addition to Abhi's comment, I had another question. But thanks for improving the documentation around this file - this already makes it a lot clearer!

// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
const isNgZoneEnabled = typeof Zone !== 'undefined' && !!Zone.current;
const isNgZoneEnabled = typeof Zone !== 'undefined' && !!Zone.root?.run;
Copy link
Member

Choose a reason for hiding this comment

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

!!Zone.root?.run is this function also available in older Angular versions? We need to stay compatible with Angular 14+

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it does.

This commit calls `showReportDialog` outside of the Angular context to prevent
unnecessary view updates when asynchronous tasks are set up within the `showReportDialog` function.
Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

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

Thank you!

@Lms24 Lms24 merged commit aecbfaf into getsentry:develop Apr 25, 2024
35 checks passed
@arturovt arturovt deleted the fix/angular-show-report branch April 25, 2024 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants