bito-code-review[bot] commented on code in PR #44069:
URL: https://github.com/apache/superset/pull/44069#discussion_r4086770925


##########
superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx:
##########
@@ -505,13 +513,63 @@ export default function PluginFilterSelect(props: 
PluginFilterSelectProps) {
           label: undefined,
         },
       });
-
-      updateDataMask(null);
+      // A Search-all query lives in ownState.search and a debounced onSearch
+      // callback may still be pending. Cancel and reset both so the option
+      // list is not silently re-scoped to a stale search term while the
+      // filter shows an empty input. Only search-all filters carry a
+      // server-side search at all: a plain filter re-emitting ownState at
+      // staging (pre-Apply) would reload its options before Apply is clicked.
+      if (searchAllOptions) {
+        onSearch.cancel();
+        dispatchDataMask({
+          type: 'ownState',
+          ownState: { search: '' },
+        });
+      }

Review Comment:
   <!-- Bito Reply -->
   The suggestion provided by the reviewer is appropriate and addresses the 
identified issue. By making `onSearch.cancel()` unconditional, you ensure that 
any pending debounced search operations are properly cleared regardless of the 
filter type, preventing stale search terms from affecting the filter state.
   
   **superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx**
   ```
   onSearch.cancel();
         if (searchAllOptions) {
           dispatchDataMask({
             type: 'ownState',
             ownState: { search: '' },
           });
         }
   ```



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