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

   ### SUMMARY
   `ComparisonRangeLabel` 
(superset-frontend/src/explore/components/controls/ComparisonRangeLabel.tsx) 
has used `Promise.resolve({ value: '' })` as a sentinel for "no computable 
custom/inherit comparison range" since it was introduced across #27718, #28057, 
and #30002, and `setLabels(res.map(r => r.value ?? ''))` (originally from 
#27718) has always stored that sentinel verbatim. The render guard at the 
bottom of the component only checks `labels.length`, so `['']` (length 1, from 
a custom start date after the current range start, or "Custom" with no start 
date) still satisfies it and renders the "Actual range for comparison" header 
with an empty line underneath.
   
   This change filters out empty-string labels before they reach state, so the 
header only renders when there's a real value to show. It also drops the 
redundant Fragment wrapping each already-keyed label `<div>` (same component, 
flagged in the same report) — the Fragment had no key of its own while the 
`<div>` inside it did, which is both redundant and a latent React key-collision 
risk if two labels were ever equal.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   No running Superset instance was available in this environment to capture 
real before/after screenshots this run (static + Jest-only investigation and 
fix). The reproduction is instead demonstrated by the added Jest assertions 
(`ComparisonRangeLabel.test.tsx`), which fail on current master and pass after 
the fix.
   
   ### TESTING INSTRUCTIONS
   1. In Explore, add a temporal filter (e.g. `order_date` between two dates).
   2. Open the time comparison control, choose "Custom", and either leave the 
start date empty or set it to a date *after* the filter's range start.
   3. Before the fix: the "Actual range for comparison" header appears with a 
blank line beneath it. After the fix: nothing renders.
   4. Automated: `NODE_ENV=test npx jest 
src/explore/components/controls/ComparisonRangeLabel.test.tsx` from 
`superset-frontend/`.
   
   ### ADDITIONAL INFORMATION
   - [x] Has associated issue: Fixes #44917
   - [ ] 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
   
   🤖 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