codeant-ai-for-open-source[bot] commented on code in PR #42126:
URL: https://github.com/apache/superset/pull/42126#discussion_r3616073528
##########
superset-frontend/plugins/preset-chart-deckgl/src/layers/Contour/Contour.tsx:
##########
@@ -69,13 +68,8 @@ export const getLayer: GetLayerType<ContourLayer> = function
({
emitCrossFilters,
}) {
const fd = formData;
- const {
- aggregation = 'SUM',
- js_data_mutator: jsFnMutator,
- contours: rawContours,
- cellSize = '200',
- } = fd;
- let data = payload.data.features;
+ const { aggregation = 'SUM', contours: rawContours, cellSize = '200' } = fd;
+ const data = payload.data.features;
Review Comment:
**Suggestion:** `payload.data.features` is accessed without a null check, so
this will throw at runtime when the layer receives an empty/errored payload
shape (for example during failed queries or transitional states). Guard
`payload`/`payload.data` and default to an empty features array before
iterating. [null pointer]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ❌ Contour deck.gl layer crashes on errored query payloads.
- ⚠️ Affected charts show blank or error instead of map.
- ⚠️ Dashboard stability reduced when backend responses are inconsistent.
```
</details>
<details>
<summary><b>Steps of Reproduction ✅ </b></summary>
```mdx
1. In the Superset UI, render a deck.gl Contour chart which uses the Contour
layer
implementation at
`superset-frontend/plugins/preset-chart-deckgl/src/layers/Contour/Contour.tsx:61`
(`export
const getLayer`).
2. The chart plugin infrastructure (via `createDeckGLComponent`, imported at
`Contour.tsx:24`) calls `getLayer` with the `payload` object returned from
the backend; in
an error or transitional state this `payload` may be present but lack a
`data` property
(e.g., `{ error: ... }`).
3. Inside `getLayer`, execution reaches
`superset-frontend/plugins/preset-chart-deckgl/src/layers/Contour/Contour.tsx:72`,
where
`const data = payload.data.features;` is evaluated while `payload.data` is
`undefined`.
4. The browser throws `TypeError: Cannot read properties of undefined
(reading
'features')`, causing the Contour layer (and potentially the entire deck.gl
visualization
component using this layer) to fail rendering.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=e5f301e4655746928c75956ab5ec4f85&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=e5f301e4655746928c75956ab5ec4f85&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:**
superset-frontend/plugins/preset-chart-deckgl/src/layers/Contour/Contour.tsx
**Line:** 72:72
**Comment:**
*Null Pointer: `payload.data.features` is accessed without a null
check, so this will throw at runtime when the layer receives an empty/errored
payload shape (for example during failed queries or transitional states). Guard
`payload`/`payload.data` and default to an empty features array before
iterating.
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.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42126&comment_hash=e8139a3ad1d68d6b4115a316154cfe72844eb6e9f2df11aa8b84ad2828451687&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42126&comment_hash=e8139a3ad1d68d6b4115a316154cfe72844eb6e9f2df11aa8b84ad2828451687&reaction=dislike'>👎</a>
--
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]