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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]