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 12:22:32 UTC

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

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


##########
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:
   Yeah. You are right. Thanks for the good suggestion! @diegomedina248 



-- 
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