diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx index 7426cb7a0aa2b..4fa58e491f254 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx @@ -474,6 +474,7 @@ export const FiltersConfigForm: React.FC = ({ hasDataset={hasDataset} form={form} formData={newFormData} + enableNoResults={enableNoResults} /> ) : hasFilledDataset ? ( t('Click "Populate" to get "Default Value" ->') diff --git a/superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx b/superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx index 9bcf7fad5f526..deab33533e4c9 100644 --- a/superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx +++ b/superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx @@ -146,14 +146,8 @@ export default function PluginFilterSelect(props: PluginFilterSelectProps) { }; useEffect(() => { - const firstItem: SelectValue = data[0] - ? (groupby.map(col => data[0][col]) as string[]) - : null; - if (!isDisabled && defaultToFirstItem && firstItem) { - // initialize to first value if set to default to first item - setValues(firstItem); - } else if (!isDisabled && defaultValue?.length) { - // initialize to saved value + if (!isDisabled && defaultValue?.length) { + // initialize to default value setValues(defaultValue); } // initialize column types (these should only be set once) @@ -167,6 +161,19 @@ export default function PluginFilterSelect(props: PluginFilterSelectProps) { } }, []); + useEffect(() => { + const firstItem: SelectValue = data[0] + ? (groupby.map(col => data[0][col]) as string[]) + : null; + if (!isDisabled && defaultToFirstItem && firstItem) { + // initialize to first value if set to default to first item + setValues(firstItem); + } else if (!isDisabled && defaultValue?.length) { + // initialize to saved value + setValues(defaultValue); + } + }, [defaultValue]); + const [col] = groupby; const datatype: GenericDataType = coltypeMap[col]; const labelFormatter = getDataRecordFormatter({