codeant-ai-for-open-source[bot] commented on code in PR #40765:
URL: https://github.com/apache/superset/pull/40765#discussion_r3372707199
##########
superset-frontend/packages/superset-ui-core/src/components/Table/index.tsx:
##########
@@ -427,6 +427,7 @@ export function Table<RecordType extends object>(
bordered,
expandable: {
childrenColumnName,
+ ...rest.expandable,
},
Review Comment:
**Suggestion:** This merge is effectively lost because `rest` is later
spread into `<StyledTable {...rest} />`, and `rest` still contains
`expandable`; that final spread overwrites the merged object and drops
`childrenColumnName` whenever an `expandable` prop is provided. Destructure
`expandable` out of `props` (so it is not in `rest`) and merge from that
variable, otherwise combined expandable configuration is not actually applied.
[logic error]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ❌ Table wrapper ignores combined childrenColumnName and expandable
settings.
- ⚠️ ListView expandable config cannot leverage childrenColumnName mapping.
- ⚠️ Storybook InteractiveTable misrepresents expandable/childrenColumnName
behavior.
```
</details>
<details>
<summary><b>Steps of Reproduction ✅ </b></summary>
```mdx
1. Open the Storybook interactive story `InteractiveTable` defined in
`superset-frontend/packages/superset-ui-core/src/components/Table/Table.stories.tsx:22-27`,
which renders `<Table {...args} />` and exposes all `TableProps` via
controls.
2. In Storybook controls, set `childrenColumnName` to a string (e.g.
`"children"`) and set
`expandable` to an object (e.g. `{ expandedRowRender: (record) => 'details'
}`), so both
props are passed through to `Table`.
3. These props reach the `Table` component in
`superset-frontend/packages/superset-ui-core/src/components/Table/index.tsx:260-299`,
where `childrenColumnName` is destructured and the rest of the props
(including
`expandable`) are collected into `rest`.
4. `sharedProps` is constructed at `index.tsx:155-173` with `expandable: {
childrenColumnName, ...rest.expandable }`, but when rendering `StyledTable`
at
`index.tsx:176-183`, the JSX spreads `{...sharedProps}` and then
`{...rest}`; because
`rest` still contains `expandable`, React's prop merge overwrites the merged
`expandable`
object with the raw `rest.expandable`, so the `childrenColumnName` from
`sharedProps` is
dropped and the combined configuration is never applied.
```
</details>
[Fix in
Cursor](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=7c0d0741ca1e41738f7232cba0401cb5&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
| [Fix in VSCode
Claude](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=7c0d0741ca1e41738f7232cba0401cb5&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/packages/superset-ui-core/src/components/Table/index.tsx
**Line:** 428:431
**Comment:**
*Logic Error: This merge is effectively lost because `rest` is later
spread into `<StyledTable {...rest} />`, and `rest` still contains
`expandable`; that final spread overwrites the merged object and drops
`childrenColumnName` whenever an `expandable` prop is provided. Destructure
`expandable` out of `props` (so it is not in `rest`) and merge from that
variable, otherwise combined expandable configuration is not actually applied.
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%2F40765&comment_hash=b2fae191448661ae5cb0218ec9ea16786dda458e37be4115e15c730e8b0902d7&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40765&comment_hash=b2fae191448661ae5cb0218ec9ea16786dda458e37be4115e15c730e8b0902d7&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]