sadpandajoe opened a new pull request, #43949:
URL: https://github.com/apache/superset/pull/43949
### SUMMARY
Applying a cross-filter (e.g. clicking a chart to filter other charts) could
result in the same filter appearing twice in the dashboard's FilterBar for a
single render, instead of exactly once.
Root cause: `FilterControls` mirrored `DropdownContainer`'s main-row/overflow
partition into its own React state one render late, while `DropdownContainer`
itself decides that partition synchronously. During that one-render lag, the
popover's stale mirrored overflow list could still include an item that had
already moved back into `DropdownContainer`'s fresh main row, producing two
copies of the same chip in the DOM at once.
Fix: `FilterControls` now builds the "More filters" popover's content
directly from the same-render `overflowedItems` argument `DropdownContainer`
already passes into it, instead of its own asynchronously-mirrored state —
removing the second, independently-timed source of truth entirely. The
trigger badge count and tooltip continue to use the existing mirrored state,
since a momentarily-stale count is cosmetic and was not the reported bug.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
- BEFORE: a cross-filter's chip could transiently render twice in the
FilterBar (once in the main row, once in the "More filters" popover)
during the same render.
- AFTER: exactly one chip renders for each applied cross-filter.
- Evidence: following (independent QA capture in progress).
### TESTING INSTRUCTIONS
Added a regression test in `FilterControls.overflow.test.tsx` that drives
`DropdownContainer`'s partition and `FilterControls`'s mirrored overflow
state independently, reproducing the exact one-render desync and asserting
the chip renders exactly once before and after the state disagreement.
To verify manually: create a dashboard with multiple charts, apply a
cross-filter by interacting with one chart (click-to-filter or the chart's
context menu), and confirm the FilterBar shows exactly one entry for it,
including while resizing the browser window or dashboard sidebar to trigger
the FilterBar's overflow recalculation.
### 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]