Skip to content

fix(ui): avoid sample data children column crash#28691

Open
puneetdixit200 wants to merge 1 commit into
open-metadata:mainfrom
puneetdixit200:fix-sample-data-children-column
Open

fix(ui): avoid sample data children column crash#28691
puneetdixit200 wants to merge 1 commit into
open-metadata:mainfrom
puneetdixit200:fix-sample-data-children-column

Conversation

@puneetdixit200
Copy link
Copy Markdown

Description

Fixes #28585.

The Sample Data table can receive user-defined column names, including children. Ant Design treats children as its default tree-data field, so a scalar sample value under that column can be interpreted as expandable row data and crash the table.

This sets a non-conflicting childrenColumnName only for the Sample Data table and adds regression coverage for rendering a sample column named children.

Tests

  • npm_config_cache=/tmp/openmetadata-npm-cache npx --yes prettier@2.8.8 --config './.prettierrc.yaml' --ignore-path './.prettierignore' --check src/components/Database/SampleDataTable/SampleDataTable.component.tsx src/components/Database/SampleDataTable/SampleDataTable.test.tsx
  • git diff --check

Not run locally:

  • yarn test src/components/Database/SampleDataTable/SampleDataTable.test.tsx --runInBand
  • yarn lint:base src/components/Database/SampleDataTable/SampleDataTable.component.tsx src/components/Database/SampleDataTable/SampleDataTable.test.tsx

The full UI dependency install could not complete on this machine because it exhausted available local disk space.

Copilot AI review requested due to automatic review settings June 4, 2026 06:55
@puneetdixit200 puneetdixit200 requested a review from a team as a code owner June 4, 2026 06:55
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR addresses a rendering conflict when sample data contains a column named children by configuring the table to use an alternative nested-row key.

Changes:

  • Added a childrenColumnName override to the sample data table to avoid collisions with a children data field.
  • Added a regression test to ensure sample data renders correctly when a column is named children.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
openmetadata-ui/src/main/resources/ui/src/components/Database/SampleDataTable/SampleDataTable.component.tsx Overrides the table’s children nesting key to prevent conflicts with a children column in sample data.
openmetadata-ui/src/main/resources/ui/src/components/Database/SampleDataTable/SampleDataTable.test.tsx Adds coverage for the edge case where a sample-data column is named children.

Comment on lines +83 to +106
it('Renders sample data when a column is named children', async () => {
(getSampleDataByTableId as jest.Mock).mockImplementationOnce(() =>
Promise.resolve({
...MOCK_TABLE,
columns: [
{ ...MOCK_TABLE.columns[0], name: 'id' },
{ ...MOCK_TABLE.columns[1], name: 'children' },
{ ...MOCK_TABLE.columns[2], name: 'active' },
],
sampleData: {
columns: ['id', 'children', 'active'],
rows: [['1', false, true]],
},
})
);

await act(async () => {
render(<SampleDataTable {...mockProps} />);
});

expect(screen.getByText('children')).toBeInTheDocument();
expect(screen.getByText('false')).toBeInTheDocument();
expect(screen.getByText('true')).toBeInTheDocument();
});
Comment on lines +61 to +62
const SAMPLE_DATA_CHILDREN_COLUMN_NAME =
'__openmetadata_sample_data_children__';
</Space>

<TableComponent
childrenColumnName={SAMPLE_DATA_CHILDREN_COLUMN_NAME}
@gitar-bot
Copy link
Copy Markdown

gitar-bot Bot commented Jun 4, 2026

Code Review ✅ Approved

Sets a unique childrenColumnName for the Sample Data table to prevent rendering crashes when column names conflict with Ant Design props. Regression coverage for the 'children' column naming conflict is included.

Options

Display: compact → Showing less information.

Comment with these commands to change:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sample Data tab crashes the whole page when a column is named children (reserved Antd childrenColumnName)

2 participants