Jeanluca Scaljeri
Jeanluca Scaljeri

Reputation: 29149

Angular: Async process not triggering changeDetection only in >= Chrome 64

I'm monitoring the size of an element in angular using ResizeObserver

 observer = new window.ResizeObserver(entries => {
     ...
     someComponent.width = width;
 });
 observer.observe(target);

stackblitz

When you run the code in safary, firefox or chrome 63 it works just fine

enter image description here

So, in chrome 64 (can-i-use -> native support) it doesn't work any more and it looks like this:

enter image description here

Somehow chrome doesn't do changeDetection for triggers from ResizeObserver

Any suggestion what might be the reason for this strange behaviour?

UPDATE: I'v updated my post based on the discussion below

Upvotes: 1

Views: 513

Answers (1)

jiali passion
jiali passion

Reputation: 1711

zone.js provide a patch for ResizeObserver >= chrome 64, it is not released, please wait for next version of zone.js (0.8.21) https://github.com/angular/zone.js/pull/1012 here is a working sample.

https://github.com/JiaLiPassion/zone-resize-observer

Upvotes: 1

Related Questions