jesperct opened a new pull request, #42111:
URL: https://github.com/apache/superset/pull/42111

   ### SUMMARY
   In the horizontal filter bar, clicking "Clear all" did not really clear 
filters that have a default value configured ("Filter has default value" or 
"Select first filter value by default"). The values reappeared right after the 
click and the Apply button stayed disabled, so there was no way to load the 
dashboard without those filters. The vertical filter bar was not affected.
   
   Root cause: `handleClearAll` staged the cleared select value as `undefined`, 
which is the same value the select filter plugin's initialization effect uses 
to detect an uninitialized filter. The horizontal bar is the only orientation 
that forwards `clearAllTriggers` into the filter plugins, and consuming the 
trigger re-runs that initialization effect. Since the staged value was 
`undefined`, the effect re-applied the configured default (or the first item) 
and the selection immediately came back, leaving Apply disabled because the 
selection matched the applied state again.
   
   The fix stages the cleared value as an explicit `null` instead, which the 
plugins already treat as "intentionally empty" (range filters already stage 
`[null, null]`). The initialization effect then leaves the cleared value alone 
and Apply stays enabled so the cleared state can be committed.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   Before (horizontal bar right after "Clear all": defaults are back and Apply 
is disabled):
   
   ![before](https://files.catbox.moe/jjahp1.png)
   
   After (same click: filters stay cleared and Apply is enabled):
   
   ![after](https://files.catbox.moe/mssmdc.png)
   
   ### TESTING INSTRUCTIONS
   1. Create a dashboard with a chart and three select filters: one with 
"Filter has default value", one with "Select first filter value by default", 
and one plain.
   2. Set the filter bar orientation to Horizontal and save.
   3. Reload the dashboard so the default values populate.
   4. Click "Clear all".
   5. All three filters should now be empty and "Apply" should be enabled; 
clicking it loads the dashboard without any filters applied.
   
   ### ADDITIONAL INFORMATION
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [x] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


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