villebro commented on a change in pull request #14710:
URL: https://github.com/apache/superset/pull/14710#discussion_r637035042
##########
File path:
superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx
##########
@@ -53,33 +109,68 @@ export default function PluginFilterSelect(props:
PluginFilterSelectProps) {
inverseSelection,
inputRef,
defaultToFirstItem,
+ searchAllOptions,
} = formData;
- const forceFirstValue =
+ const isDisabled =
appSection === AppSection.FILTER_CONFIG_MODAL && defaultToFirstItem;
const groupby = ensureIsArray<string>(formData.groupby);
// Correct initial value for Ant Select
- const initSelectValue: SelectValue =
- // `defaultValue` can be `FIRST_VALUE` if `defaultToFirstItem` is checked,
so need convert it to correct value for Select
- defaultValue === FIRST_VALUE ? [] : defaultValue ?? [];
-
- const firstItem: SelectValue = data[0]
- ? (groupby.map(col => data[0][col]) as string[]) ?? initSelectValue
- : initSelectValue;
// If we are in config modal we always need show empty select for
`defaultToFirstItem`
- const [values, setValues] = useState<SelectValue>(
- defaultToFirstItem && appSection !== AppSection.FILTER_CONFIG_MODAL
- ? firstItem
- : initSelectValue,
- );
Review comment:
The `FIRST_VALUE` placeholder doesn't really work, as we don't know what
the first value is for each individual user, which means that it won't be
possible to persist `extraFormData` at filter configuration time.
--
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]