You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/07/20 10:59:18 UTC

[GitHub] [superset] diegomedina248 commented on a diff in pull request #20783: fix(plugin-chart-echarts): layout broken when resizing

diegomedina248 commented on code in PR #20783:
URL: https://github.com/apache/superset/pull/20783#discussion_r925468312


##########
superset-frontend/plugins/plugin-chart-echarts/src/components/Echart.tsx:
##########
@@ -92,11 +92,10 @@ function Echart(
     previousSelection.current = currentSelection;
   }, [currentSelection]);
 
-  useEffect(() => {
-    if (chartRef.current) {
-      chartRef.current.resize({ width, height });
-    }
-  }, [width, height]);
+  // Ensure that each render and resize is idempotent
+  if (chartRef.current) {
+    chartRef.current.resize({ width, height });

Review Comment:
   will this trigger an expensive operation on the chart? Cause this will run on each render now.
   Could useLayoutEffect work?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org