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/06/23 10:31:34 UTC

[GitHub] [superset] villebro commented on a change in pull request #15302: feat(native-filters): Set default scope by filters' and charts' datasets

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



##########
File path: superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx
##########
@@ -580,6 +592,28 @@ const FiltersConfigForm = (
     setActiveFilterPanelKey(activeFilterPanelKey);
   }, [hasCheckedAdvancedControl]);
 
+  const initiallyExcluded = useMemo(() => {

Review comment:
       nit: `initiallyExcludedCharts`

##########
File path: superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FilterScope/FilterScope.tsx
##########
@@ -56,11 +57,41 @@ const FilterScope: FC<FilterScopeProps> = ({
   scope,
   updateFormValues,
   chartId,
+  initiallyExcludedCharts,
 }) => {
-  const initialScope = scope || getDefaultScopeValue(chartId);
-  const initialScoping = isScopingAll(initialScope, chartId)
-    ? Scoping.all
-    : Scoping.specific;
+  const [initialScope] = useState(
+    scope || getDefaultScopeValue(chartId, initiallyExcludedCharts),
+  );
+  const [initialScoping] = useState(
+    isScopingAll(initialScope, chartId) ? Scoping.all : Scoping.specific,
+  );

Review comment:
       This isn't directly related to this PR, but it confused me while reading this code: having two props called `initialScope` and `initialScoping` right next to each other feels very ambiguous. If changing this to something slightly more specific doesn't lead down a huge rabbit hole, I'd opt for renaming `Scoping` to `ScopingType` and consequently `initialScoping` to `initialScopingType`, perhaps even `initialScope` to `initialChartScope`.




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

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