codeant-ai-for-open-source[bot] commented on code in PR #36784:
URL: https://github.com/apache/superset/pull/36784#discussion_r2638836213
##########
superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Polygon/Polygon.tsx:
##########
@@ -212,7 +212,7 @@ export const getLayer: GetLayerType<PolygonLayer> =
function ({
getPolygon: getPointsFromPolygon,
getFillColor: colorScaler,
getLineColor: sc ? [sc.r, sc.g, sc.b, 255 * sc.a] : undefined,
- getLineWidth: fd.line_width,
+ lineWidthMinPixels: fd.stroked ? fd.line_width : 0,
Review Comment:
**Suggestion:** Type coercion risk: `fd.line_width` may be a string or
undefined coming from form data; passing it directly to Deck.gl can produce
unexpected rendering values or runtime NaNs. Convert to a numeric value and
provide a safe fallback. [type error]
**Severity Level:** Minor ⚠️
```suggestion
lineWidthMinPixels: fd.stroked ? (Number(fd.line_width) || 0) : 0,
```
<details>
<summary><b>Why it matters? ⭐ </b></summary>
Coercing form data to a number prevents passing strings/NaN into Deck.gl
which expects a numeric pixel value.
The current code assumes fd.line_width is already a number; in practice form
controls may yield strings or undefined.
Number(...) || 0 is a small, safe change that avoids unexpected rendering or
runtime NaNs.
</details>
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:**
superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Polygon/Polygon.tsx
**Line:** 215:215
**Comment:**
*Type Error: Type coercion risk: `fd.line_width` may be a string or
undefined coming from form data; passing it directly to Deck.gl can produce
unexpected rendering values or runtime NaNs. Convert to a numeric value and
provide a safe fallback.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
```
</details>
--
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]