villebro commented on a change in pull request #14788:
URL: https://github.com/apache/superset/pull/14788#discussion_r638567397
##########
File path:
superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx
##########
@@ -100,29 +99,36 @@ export default function PluginFilterSelect(props:
PluginFilterSelectProps) {
defaultToFirstItem,
searchAllOptions,
} = formData;
+ const groupby = ensureIsArray<string>(formData.groupby);
+ const [col] = groupby;
+ const [currentSuggestionSearch, setCurrentSuggestionSearch] = useState('');
+ const [dataMask, dispatchDataMask] = useReducer<DataMaskReducer>(reducer, {
+ filterState,
+ ownState: {
+ coltypeMap,
+ },
+ });
+ const updateDataMask = (values: SelectValue) => {
+ const emptyFilter =
+ enableEmptyFilter && !inverseSelection && values?.length === 0;
+
+ dispatchDataMask({
+ type: 'filterState',
+ extraFormData: getSelectExtraFormData(
+ col,
+ values,
+ emptyFilter,
+ inverseSelection,
+ ),
+ filterState: {
+ value: values,
+ },
+ });
+ };
const isDisabled =
appSection === AppSection.FILTER_CONFIG_MODAL && defaultToFirstItem;
- const groupby = ensureIsArray<string>(formData.groupby);
- // Correct initial value for Ant Select
-
- // If we are in config modal we always need show empty select for
`defaultToFirstItem`
- const [values, setValues] = useState<SelectValue>(
- !isDisabled && defaultValue?.length ? defaultValue : [],
- );
Review comment:
state handling is now deferred to the application, i.e. filter state is
only being set via `setDataMask`.
--
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]