sadpandajoe opened a new issue, #44913:
URL: https://github.com/apache/superset/issues/44913

   
   ### Bug description
   
   Several checks in the Contour control use truthiness on numeric thresholds, 
so `0` is treated as missing:
   
   - An isoband with `lowerThreshold: -1, upperThreshold: 0` is classified as 
an isoline: re-opening it selects the Isoline tab and the option label/tooltip 
shows it as an isoline.
   - A threshold of `0` renders as an empty input in the Isoband tab, and the 
"lower must be lower than upper" validation is skipped when either value is 0.
   - An isoline with `lowerThreshold: 0` is labelled with threshold `-1` 
(`lowerThreshold || -1`).
   
   Steps to reproduce: add an Isoband with lower = -1, upper = 0, Save, then 
re-open it (or look at its label in the control).
   
   Expected: `0` is a valid threshold; the contour stays an isoband.
   
   ### Where
   
   
`superset-frontend/src/explore/components/controls/ContourControl/ContourPopoverControl.tsx`
   - L49-L54 `isIsoband`: `return contour.upperThreshold && 
contour.lowerThreshold;`
   - L83-L84 validation guard `contour.upperThreshold && contour.lowerThreshold`
   - L289, L304 `value={contour.lowerThreshold || ''}` / `upperThreshold || ''`
   
   
`superset-frontend/src/explore/components/controls/ContourControl/ContourOption.tsx`
   - L52 `const isIsoband = upperThreshold;`
   - L69-L70 `lowerThreshold || -1`
   
   ### Suggested fix
   
   Use `!= null` / `typeof x === 'number'` checks (and `?? ''` for the inputs) 
instead of truthiness.
   
   ### Found by
   
   Found while adding React Testing Library coverage for Explore controls (all 
line numbers are against `master` at `bc3698b5d6`).
   


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