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

   
   ### Bug description
   
   When a contour is saved, `convertContourToNumeric` runs `Number(...)` over 
all of `lowerThreshold`, `upperThreshold` and `strokeWidth`, including the ones 
the chosen type deliberately leaves `undefined`:
   
   - saving an Isoline produces `upperThreshold: NaN`
   - saving an Isoband produces `strokeWidth: NaN`
   
   `NaN` ends up in the control value (and serializes to `null` in 
`form_data`). Note: a cleared/blank threshold itself does not reach this path 
because Save is disabled until the threshold passes the completeness check; the 
NaN comes from the `undefined` fields.
   
   Steps to reproduce: deck.gl Contour chart -> Contours control -> add an 
Isoline (threshold, stroke width, colour) -> Save. Inspect the control value / 
form_data: `upperThreshold` is `NaN`/`null`.
   
   Expected: unused fields stay `undefined` and are omitted.
   
   ### Where
   
   
`superset-frontend/src/explore/components/controls/ContourControl/ContourPopoverControl.tsx`
   
   - L101-L108 `convertContourToNumeric`: `formattedContour[key] = 
Number(formattedContour[key]);` for every numeric key
   - L110-L122 `formatIsoline`/`formatIsoband` set the unused key to 
`undefined` first, so `Number(undefined)` is `NaN`.
   
   ### Suggested fix
   
   Only convert keys whose value is not `undefined` (`if (formattedContour[key] 
!== undefined)`).
   
   ### 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