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/10/07 08:47:00 UTC

[GitHub] [superset] villebro commented on a change in pull request #16994: fix: Unnecessary queries when changing filter values

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



##########
File path: superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterControls.tsx
##########
@@ -63,7 +63,8 @@ const FilterControls: FC<FilterControlsProps> = ({
       dataMask: dataMaskSelected[filter.id],
     }));
     return buildCascadeFiltersTree(filtersWithValue);
-  }, [filterValues, dataMaskSelected]);
+    // eslint-disable-next-line react-hooks/exhaustive-deps
+  }, [JSON.stringify(filterValues), dataMaskSelected]);

Review comment:
       > Can we wrap `filterValues` in line 51 in useMemo instead? Like
   > 
   > ```
   > const filterValues = useMemo(() => Object.values<Filter>(filters), [filters]);
   > ```
   
   That's a good idea - however, won't we need to use stringify `filter` in the deps array? Seems like the object reference may change without the contents actually changing.




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