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



##########
File path: 
superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx
##########
@@ -115,18 +140,27 @@ export default function PluginFilterSelect(props: 
PluginFilterSelectProps) {
   };
 
   useEffect(() => {
-    handleChange(currentValue ?? []);
+    // For currentValue we need set always `FIRST_VALUE` only if we in config 
modal for `defaultToFirstItem` mode
+    handleChange(
+      isDefaultToFirstItemInFilterConfigModal
+        ? FIRST_VALUE
+        : currentValue ?? [],
+    );
   }, [
     JSON.stringify(currentValue),
+    defaultToFirstItem,

Review comment:
       Shouldn't this be `isDefaultToFirstItemInFilterConfigModal`?

##########
File path: 
superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx
##########
@@ -66,39 +68,62 @@ export default function PluginFilterSelect(props: 
PluginFilterSelectProps) {
     currentValue,
     inverseSelection,
     inputRef,
+    defaultToFirstItem,
   } = formData;
 
-  const [values, setValues] = useState<(string | number | boolean)[]>(
-    defaultValue ?? [],
-  );
+  const isDefaultToFirstItemInFilterConfigModal =
+    appSection === AppSection.FILTER_CONFIG_MODAL && defaultToFirstItem;

Review comment:
       This is a bit of a name monster 👹 . Could we just call this 
`forceFirstValue`, as I think it applies both to the change handler and the 
component disabler?

##########
File path: 
superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx
##########
@@ -17,17 +17,18 @@
  * under the License.
  */
 import {
-  createMultiFormatter,
   Behavior,
+  createMultiFormatter,
   DataMask,
   ensureIsArray,
   GenericDataType,
+  AppSection,

Review comment:
       ABC




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

Reply via email to