From 7169a5c92d9c50391fa54c0a4e8f73f0224854d0 Mon Sep 17 00:00:00 2001 From: Andy Boughton Date: Mon, 28 Feb 2022 12:32:46 -0500 Subject: [PATCH] Reduce "resizeobserver loop limit exceeded" errors by using RAF for resizes (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) --- esm/components/plot.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/esm/components/plot.js b/esm/components/plot.js index 9a7eb5aa..a4dcb2e2 100644 --- a/esm/components/plot.js +++ b/esm/components/plot.js @@ -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);