Skip to content

Commit

Permalink
Reduce "resizeobserver loop limit exceeded" errors by using RAF for r…
Browse files Browse the repository at this point in the history
…esizes

(keeps listener on window, rather than resizeobserver, because normal Lz actions can cause the container to resize and we don't want out of control iterative redraws)
  • Loading branch information
abought committed Feb 28, 2022
1 parent 4247c68 commit 7169a5c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion esm/components/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,8 @@ class Plot {
d3.select(this.container).classed('lz-container-responsive', true);

// If this is a responsive layout then set a namespaced/unique onresize event listener on the window
const resize_listener = () => this.rescaleSVG();
const resize_listener = () => window.requestAnimationFrame(() => this.rescaleSVG());

window.addEventListener('resize', resize_listener);
this.trackExternalListener(window, 'resize', resize_listener);

Expand Down

0 comments on commit 7169a5c

Please sign in to comment.