Title: 3rd party packages can cause console.log() to trigger change detection · Issue #28647 · angular/angular · GitHub
Open Graph Title: 3rd party packages can cause console.log() to trigger change detection · Issue #28647 · angular/angular
X Title: 3rd party packages can cause console.log() to trigger change detection · Issue #28647 · angular/angular
Description: 🐞 bug report Affected Package The issue is caused by package @angular/core. Is this a regression? No. Description If a 3rd party library adds behavior to the console.log() function, zone.js will erroneously trigger change detection. If t...
Open Graph Description: 🐞 bug report Affected Package The issue is caused by package @angular/core. Is this a regression? No. Description If a 3rd party library adds behavior to the console.log() function, zone.js will er...
X Description: 🐞 bug report Affected Package The issue is caused by package @angular/core. Is this a regression? No. Description If a 3rd party library adds behavior to the console.log() function, zone.js will er...
Opengraph URL: https://github.com/angular/angular/issues/28647
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"3rd party packages can cause console.log() to trigger change detection","articleBody":"# 🐞 bug report\r\n\r\n### Affected Package\r\nThe issue is caused by package @angular/core.\r\n\r\n\r\n### Is this a regression?\r\nNo.\r\n\r\n\r\n### Description\r\nIf a 3rd party library adds behavior to the `console.log()` function, `zone.js` will erroneously trigger change detection. If the `console.log()` statement is in a function bound to the view model, change detection can recursively run.\r\n\r\nAn easy way to prevent the problem would be to wrap the `console.log` statement to run outside of angular. However, this is very unwieldy and not-obvious to a developer adding `console.log` statements to debug their program (aka me).\r\n\r\nI recognize that this likely could be considered an issue with the 3rd party package. However, I'm not entirely certain that there is anything that _can_ be done from that package, as it is meant to be a generic package used in a variety of projects, and not just Angular projects.\r\n\r\nThe 3rd party package, in this case, is [Sentry](https://github.com/getsentry/sentry-javascript), which overwrites the `console.log` function in order to record breadcrumbs for error logging. I'm opening an issue both here and against Sentry's repo, because I'm very uncertain which project can/should ultimately fix this issue.\r\n\r\nEdit: https://github.com/getsentry/sentry-javascript/issues/1883\r\n\r\n## 🔬 Minimal Reproduction\r\nReproduction repo that uses [Sentry](https://github.com/getsentry/sentry-javascript) to reproduce the problem: https://github.com/ibedard16/sentry-recursion-demo\r\n\r\nInstructions to reproduce are in the [readme](https://github.com/ibedard16/sentry-recursion-demo#the-demo).\r\n\r\n\r\n## 🌍 Your Environment\r\n\r\n**Angular Version:**\r\n\u003cpre>\u003ccode>\r\n _ _ ____ _ ___\r\n / \\ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|\r\n / △ \\ | '_ \\ / _` | | | | |/ _` | '__| | | | | | |\r\n / ___ \\| | | | (_| | |_| | | (_| | | | |___| |___ | |\r\n /_/ \\_\\_| |_|\\__, |\\__,_|_|\\__,_|_| \\____|_____|___|\r\n |___/\r\n\r\n\r\nAngular CLI: 7.3.1\r\nNode: 8.11.3\r\nOS: win32 x64\r\nAngular: 7.2.4\r\n... animations, common, compiler, compiler-cli, core, forms\r\n... language-service, platform-browser, platform-browser-dynamic\r\n... router\r\n\r\nPackage Version\r\n-----------------------------------------------------------\r\n@angular-devkit/architect 0.11.4\r\n@angular-devkit/build-angular 0.11.4\r\n@angular-devkit/build-optimizer 0.11.4\r\n@angular-devkit/build-webpack 0.11.4\r\n@angular-devkit/core 7.1.4\r\n@angular-devkit/schematics 7.3.1\r\n@angular/cli 7.3.1\r\n@ngtools/webpack 7.1.4\r\n@schematics/angular 7.3.1\r\n@schematics/update 0.13.1\r\nrxjs 6.4.0\r\ntypescript 3.2.4\r\nwebpack 4.23.1\r\n\u003c/code>\u003c/pre>\r\n\r\n**Anything else relevant?**\r\nUsing `@sentry/browser @4.5.4`","author":{"url":"https://github.com/ibedard16","@type":"Person","name":"ibedard16"},"datePublished":"2019-02-11T18:47:55Z","url":"https://github.com/angular/angular/issues/28647"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:1c33d370-6192-2323-a485-b7cdcdfaec9a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CFCC:1C5C1D:2709C43:347C865:6B045830 |
| html-safe-nonce | a73ed68888081285b99f8f6caf7597b1a6da4752583f0a97cd9be1ac39945796 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRkNDOjFDNUMxRDoyNzA5QzQzOjM0N0M4NjU6NkIwNDU4MzAiLCJ2aXNpdG9yX2lkIjoiODMzMTk1ODUzNDIxMjQ0MjE2MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | a80cfe6d415cbefd37ff148ae4927b743046fcc4203e783938168ca89920d945 |
| hovercard-subject-tag | issue:408923356 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/28647/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7b8a1ccdd00a51da405dcbddca93998e531d9826cf0c12c387ac86cef6ab59d8/angular/angular/issues/28647 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7b8a1ccdd00a51da405dcbddca93998e531d9826cf0c12c387ac86cef6ab59d8/angular/angular/issues/28647 |
| og:image:alt | 🐞 bug report Affected Package The issue is caused by package @angular/core. Is this a regression? No. Description If a 3rd party library adds behavior to the console.log() function, zone.js will er... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ibedard16 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 910ca0e260cfec6aff11407d8dc6a0d3a4cd381a2ec9ada56627b063426892a0 |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e086f9b7e88322eb2b41885a6ad425b215737fa5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width