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

   ### SUMMARY
   In the native filters config modal, removing a filter starts a 5 second 
timer that finalizes the removal (Restore disappears, save gating clears). 
Removing a second filter within those 5 seconds cancelled the first filter's 
timer, so the first stayed in the pending-removal state indefinitely.
   
   `useItemStateManager` had a cleanup-only `useEffect` keyed on 
`[removedItems]`. React runs that cleanup whenever `removedItems` changes, not 
only on unmount, so every new removal cleared the timers of all earlier pending 
removals.
   
   Pending timers are now cleared only on unmount and in `resetState` (which 
already reset `removedItems`, so a stale timer can't repopulate the cleared 
state). A ref holds the latest `removedItems` so both paths clear the current 
timers.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   N/A (state/timing fix, no visual change).
   
   ### TESTING INSTRUCTIONS
   1. Open a dashboard with two or more native filters and open the filters 
config modal.
   2. Remove one filter, then remove a second filter within 5 seconds.
   3. After 5 seconds each removed filter's Restore action disappears (before: 
the first filter kept Restore indefinitely).
   
   Automated: `npm run test -- 
src/dashboard/components/nativeFilters/FiltersConfigModal/hooks/useFilterOperations.test.ts`.
 The new two-removal test fails on master and passes with this change. Two 
further tests guard that `resetState` and unmount still cancel pending timers.
   
   ### ADDITIONAL INFORMATION
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] 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
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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