codeant-ai-for-open-source[bot] commented on code in PR #44208:
URL: https://github.com/apache/superset/pull/44208#discussion_r3998053490
##########
superset-frontend/src/components/ListView/utils.ts:
##########
@@ -282,26 +271,28 @@ export function useListViewState({
selectedFlatRows,
toggleAllRowsSelected,
state: { pageIndex, pageSize, sortBy, filters },
- } = useTable(
+ } = useTable<D>(
{
- columns: columnsWithFilter,
+ // ListViewColumn is intentionally looser than react-table's own
+ // Column<D> (see its definition for why); react-table only reads
+ // these fields at runtime and doesn't care about the stricter typing.
+ columns: columnsWithFilter as unknown as Column<D>[],
data,
disableFilters: true,
disableSortRemove: true,
- initialState: initialState as any,
+ initialState,
Review Comment:
**Suggestion:** `useTable` reads `initialState` only during mount. Later
query changes update only the page, leaving sort and filter state inconsistent
with the URL and fetched data. [stale reference]
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Sometimes`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=ae9cab92ce9b4940952d547fc543df00&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=ae9cab92ce9b4940952d547fc543df00&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/components/ListView/utils.ts
**Line:** 283:283
**Comment:**
*Stale Reference: `useTable` reads `initialState` only during mount.
Later query changes update only the page, leaving sort and filter state
inconsistent with the URL and fetched data.
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%2F44208&comment_hash=25aef3d5ccda4283262d52306cdef740e6c3112566741e11029cd5c8b56d40a9&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44208&comment_hash=25aef3d5ccda4283262d52306cdef740e6c3112566741e11029cd5c8b56d40a9&reaction=dislike'>๐</a>
##########
superset-frontend/src/components/ListView/ListView.tsx:
##########
@@ -667,10 +670,10 @@ export function ListView<T extends object = any>({
bulkSelectEnabled={bulkSelectEnabled}
selectedFlatRows={selectedFlatRows}
toggleRowSelected={(rowId, value) => {
- const row = rows.find((r: any) => r.id === rowId);
+ const row = rows.find(r => r.id === rowId);
if (row) {
prepareRow(row);
- (row as any).toggleRowSelected(value);
+ row.toggleRowSelected(value);
}
Review Comment:
**Suggestion:** Ant Design sends the mapped record's `rowId`, but `rows` are
searched by react-table's `id`; records containing `rowId` can make checkbox
selection silently fail. [api mismatch]
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Rarely`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=b8d6f5a1edb44eef8f6d1afc215c07b2&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=b8d6f5a1edb44eef8f6d1afc215c07b2&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/components/ListView/ListView.tsx
**Line:** 672:677
**Comment:**
*Api Mismatch: Ant Design sends the mapped record's `rowId`, but `rows`
are searched by react-table's `id`; records containing `rowId` can make
checkbox selection silently fail.
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%2F44208&comment_hash=8f228bbea534a5e9b1e9d768dc0a53f9f24b0c0786787a4b60310ad9c6a1534d&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44208&comment_hash=8f228bbea534a5e9b1e9d768dc0a53f9f24b0c0786787a4b60310ad9c6a1534d&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]