codeant-ai-for-open-source[bot] commented on code in PR #43115:
URL: https://github.com/apache/superset/pull/43115#discussion_r3776402504
##########
superset-frontend/src/explore/components/DataTablesPane/components/SamplesPane.tsx:
##########
@@ -105,10 +105,13 @@ export const SamplesPane = ({
1,
)
.then(response => {
- setData(ensureIsArray(response.data));
- setColnames(ensureIsArray(response.colnames));
- setColtypes(ensureIsArray(response.coltypes));
- setRowCount(response.rowcount);
+ // A 200 that carries no `result` payload resolves to undefined here.
+ // Read through it so the pane falls back to its empty state instead
+ // of throwing a TypeError that surfaces as an internal error
message.
+ setData(ensureIsArray(response?.data));
+ setColnames(ensureIsArray(response?.colnames));
+ setColtypes(ensureIsArray(response?.coltypes));
+ setRowCount(response?.rowcount ?? 0);
Review Comment:
**Suggestion:** When a successful response contains rows but omits
`rowcount`, this fallback stores zero and the controls render a misleading `0
rows` label. `TableControls` uses the count both for display and for deciding
whether to show the label, so an absent count should not be presented as an
actual zero-row result; derive the count from the returned data or preserve an
absent/unknown state. [api mismatch]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ⚠️ Samples tab displays an incorrect row count.
- ⚠️ Row-limit controls use zero instead of returned-row count.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=ac130639b5054686ad44ade0a3765770&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=ac130639b5054686ad44ade0a3765770&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:**
superset-frontend/src/explore/components/DataTablesPane/components/SamplesPane.tsx
**Line:** 114:114
**Comment:**
*Api Mismatch: When a successful response contains rows but omits
`rowcount`, this fallback stores zero and the controls render a misleading `0
rows` label. `TableControls` uses the count both for display and for deciding
whether to show the label, so an absent count should not be presented as an
actual zero-row result; derive the count from the returned data or preserve an
absent/unknown state.
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%2F43115&comment_hash=12ad156311563a99412765ccfdcf57853404cbe755d7fbec62e29d95b052dcda&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43115&comment_hash=12ad156311563a99412765ccfdcf57853404cbe755d7fbec62e29d95b052dcda&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]