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 2021/08/25 11:44:18 UTC

[GitHub] [superset] villebro commented on a change in pull request #16444: perf(dashboard): reduce number of rerenders of Charts

villebro commented on a change in pull request #16444:
URL: https://github.com/apache/superset/pull/16444#discussion_r695669877



##########
File path: superset-frontend/src/dashboard/components/gridComponents/Chart.jsx
##########
@@ -100,6 +101,8 @@ const ChartOverlay = styled.div`
 `;
 
 export default class Chart extends React.Component {
+  static whyDidYouRender = true;
+

Review comment:
       do we want to start introducing these in the codebase now? I'm fine either way

##########
File path: superset-frontend/src/dashboard/util/charts/getFormDataWithExtraFilters.ts
##########
@@ -68,13 +69,15 @@ export default function getFormDataWithExtraFilters({
 
   // if dashboard metadata + filters have not changed, use cache if possible
   if (
-    (cachedFiltersByChart[sliceId] || {}) === filters &&
-    (colorScheme == null ||
-      cachedFormdataByChart[sliceId].color_scheme === colorScheme) &&
-    cachedFormdataByChart[sliceId].color_namespace === colorNamespace &&
-    isEqual(cachedFormdataByChart[sliceId].label_colors, labelColors) &&
+    cachedFiltersByChart[sliceId] === filters &&
+    (colorScheme === null ||
+      cachedFormdataByChart[sliceId]?.color_scheme === colorScheme) &&
+    cachedFormdataByChart[sliceId]?.color_namespace === colorNamespace &&
+    isEqual(cachedFormdataByChart[sliceId]?.label_colors, labelColors) &&
     !!cachedFormdataByChart[sliceId] &&
-    dataMask === undefined
+    areObjectsEqual(cachedFormdataByChart[sliceId]?.dataMask, dataMask, {
+      ignoreUndefined: true,
+    })

Review comment:
       While we're modifying code here and for the sake of DRY, would it make sense to break out
   ```js
   const cachedFormdata = cachedFormdataByChart[sliceId];
   ```




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