LuisSanchez commented on code in PR #37260:
URL: https://github.com/apache/superset/pull/37260#discussion_r2736714455


##########
superset-frontend/src/dashboard/components/nativeFilters/FilterBar/index.tsx:
##########
@@ -416,11 +416,18 @@ const FilterBar: FC<FiltersBarProps> = ({
   const handleClearAll = useCallback(() => {
     const newClearAllTriggers = { ...clearAllTriggers };
     nativeFilterValues.forEach(filter => {
-      const { id } = filter;
+      const { id, filterType } = filter;
+      // Range filters use [null, null] as the cleared value; others use null
+      const clearedValue = filterType === 'filter_range' ? [null, null] : null;
+      const clearedDataMask = {
+        filterState: { value: clearedValue },
+        extraFormData: {},
+      };
       if (dataMaskSelected[id]) {
+        dispatch(updateDataMask(id, clearedDataMask));
         setDataMaskSelected(draft => {
           if (draft[id].filterState?.value !== undefined) {
-            draft[id].filterState!.value = undefined;
+            draft[id].filterState!.value = clearedValue;

Review Comment:
   Indeed, this will be hard to test. I think that, in order to maintain 
backwards compatibility, we can assign `undefined` if not `filter_range`, for 
example:
   ``` javascript
   const clearedValue = filterType === 'filter_range' ? [null, null] : 
undefined;
   ```
   This should not break the code and keeps the current functionality of the 
`filter_range`.



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

To unsubscribe, e-mail: [email protected]

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