Open
Description
Describe the bug
When you have other parts of the application having iframes that are sending messages back to the parent window, silent refresh's event listener on message
is causing angular to trigger its change detection.
Stackblitz example
I can help setup if someone could point me to a seed stackblitz
To Reproduce
Steps to reproduce the behavior:
- Setup silent refresh
- Add something triggering window
message
event - add a
ngDoCheck
to any component or directive with a console.log - watch it light up.
Expected behavior
Should not have unnecessary change detect due to using silent refresh
Desktop (please complete the following information):
- OS: Windows
- Browser Chrome
- Version ^5.0.2
Additional context
I reckon this should fix it; but then again I'm not sure if there's any where else down the stream you'd need to run inside angular again.
this.ngZone.runOutsideAngular(() => {
window.addEventListener('message', this.silentRefreshPostMessageEventListener);
});