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

Remove dev tools event listener from zone.js detection #3839

Closed
1 of 2 tasks
thfsilvab opened this issue Apr 11, 2023 · 2 comments · Fixed by #3970
Closed
1 of 2 tasks

Remove dev tools event listener from zone.js detection #3839

thfsilvab opened this issue Apr 11, 2023 · 2 comments · Fixed by #3970

Comments

@thfsilvab
Copy link

thfsilvab commented Apr 11, 2023

Which @ngrx/* package(s) are the source of the bug?

store-devtools

Minimal reproduction of the bug/regression with instructions

  • Add StoreDevtoolsModule.instrument({}) to app.module.ts, just like in the example
  • Install Angular DevTools
  • Through Angular DevTools, start the profiler in the example
  • The profiler will show a lot of change detection events caused by Window.addEventListener:message
  • Remove StoreDevtoolsModule.instrument({}), repeat step 3, the change detection events won't show up anymore

Minimal reproduction of the bug/regression with instructions

It's expected that the StoreDevtools doesn't trigger any change detection.
Change detection can be costly if any component do some kind of 'heavy work' like rendering multiple components with ngForOf, even if StoreDevtools logs only in development, it's still a big overhead for a development environment, depending on the size and complexity of the project.

Versions of NgRx, Angular, Node, affected browser(s) and operating system(s)

NgRx: 15.4.0
Angular: 15.2.3
Node: 16.16
Browser: Microsoft Edge 112.0.1722.34 (64-bit)
Operating system: Windows 10

Other information

I would be willing to submit a PR to fix this issue

  • Yes
  • No
@brandonroberts
Copy link
Member

Thanks @thfsilvab. I don't see in our code where we are using addEventListener directly for store-devtools.

What's the proposed fix?

@exequiel09
Copy link

exequiel09 commented Jun 26, 2023

This happens if the Redux Devtools is enabled when on load. You need to change the value of Site Access to On Click

Screenshot 2023-06-26 at 1 58 38 PM

Also check this conversation in main Angular repo: angular/angular#45572 (comment)

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 a pull request may close this issue.

3 participants