Skip to content

refactor(DimensionalityTab): migrate table to core-ui Table component#27969

Open
shah-harshit wants to merge 12 commits intomainfrom
feat/migrate-dimensionality-tab-core-ui-table
Open

refactor(DimensionalityTab): migrate table to core-ui Table component#27969
shah-harshit wants to merge 12 commits intomainfrom
feat/migrate-dimensionality-tab-core-ui-table

Conversation

@shah-harshit
Copy link
Copy Markdown
Contributor

@shah-harshit shah-harshit commented May 7, 2026

Summary

  • Replace Ant Design Table with core-ui Table (react-aria-components) in DimensionalityTab
  • Flatten cell renderer and memoize columns for performance
  • Minor UI fix for dimension count div min-width

Test plan

  • Verify DimensionalityTab table renders correctly with all columns visible
  • Run unit tests for affected components

🤖 Generated with Claude Code


Summary by Gitar

  • Refactored DimensionalityTab:
    • Migrated DimensionalityTab table to core-ui Table component, replacing the Ant Design implementation.
    • Optimized rendering by flattening the cell renderer and memoizing table columns.
  • UI enhancements:
    • Added tw:h-8 and fontSize="xs" to dimension-select for consistent styling.
    • Updated DataQualityTab to set tw:min-w-13 on the dimension count container.
    • Added border styling to DimensionalityTab by wrapping the table in a container with tw:rounded-xl and tw:ring-1.
    • Applied consistent table container styling in DataQualityTab using tw:rounded-xl and tw:ring-1.
  • Code cleanup:
    • Reverted TransComponent custom wrapper, now utilizing standard Trans directly in DimensionalityTab.
    • Wrapped renderCell in useCallback to improve performance.
  • IncidentManager Playwright updates:
    • Updated E2E selectors to use test-case data-testids instead of Ant Design class names.
    • Refactored incidentManager.ts utility to target test cases by specific data-testid.

This will update automatically on new commits.

Replace Ant Design Table with react-aria-based Table from
@openmetadata/ui-core-components. Removes antd ColumnsType,
HelpCircle icon, and Tooltip imports in favour of Table.Head
tooltip prop. Impact-score tooltip now rendered natively by
Table.Head. Trans type error fixed via ComponentType cast.
Select dimension dropdown styled to match date picker height
(h-8/32px) and font-size xs.

Refs: open-metadata/openmetadata-collate#3837
@shah-harshit shah-harshit requested a review from a team as a code owner May 7, 2026 14:22
@shah-harshit shah-harshit self-assigned this May 7, 2026
@shah-harshit shah-harshit added UI UI specific issues safe to test Add this label to run secure Github workflows on PRs labels May 7, 2026
@shah-harshit shah-harshit changed the title refactor(DimensionalityTab): migrate table to core-ui Table component Migrate dimenstionality table to core-ui Table component May 7, 2026
Extract nested ternary cell renderer into a switch-based renderCell
function. Wrap dimensionTableColumns in useMemo([t]) to stabilize
the array reference across renders.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 62%
62.49% (63198/101119) 42.97% (34252/79704) 45.87% (10088/21992)

@gitar-bot
Copy link
Copy Markdown

gitar-bot Bot commented May 8, 2026

Code Review ✅ Approved 8 resolved / 8 findings

Migrates DimensionalityTab to the core-ui Table component and optimizes rendering through column memoization and flattened cell logic. All previous findings regarding readability, missing keys, and performance have been fully addressed.

✅ 8 resolved
Quality: Deeply nested ternary chain in cell renderer hurts readability

📄 openmetadata-ui/src/main/resources/ui/src/components/DataQuality/IncidentManager/DimensionalityTab/DimensionalityTab.tsx:285-299
The cell rendering logic (lines 286–323) uses a 4-level nested ternary expression to switch on col.id. This is hard to read and maintain. Consider extracting a helper function or using a switch statement / lookup map pattern, which is more consistent with how other core-ui Table consumers typically render cells.

Performance: dimensionTableColumns recreated on every render

📄 openmetadata-ui/src/main/resources/ui/src/components/DataQuality/IncidentManager/DimensionalityTab/DimensionalityTab.tsx:181-190
dimensionTableColumns is declared as a plain array inside the component body (lines 181–190). Since it depends on t() (which is stable across renders unless the language changes), wrapping it in useMemo with [t] as a dependency would avoid creating a new array reference on every render, preventing unnecessary reconciliation of Table.Header.

Bug: Table.Row key is undefined when record.id is missing

📄 openmetadata-ui/src/main/resources/ui/src/components/IncidentManager/IncidentManager.component.tsx:628
At line 628, key={record.id} passes undefined as the React key when record.id is absent (it's an optional field in TestCaseResolutionStatus). If multiple records lack an id, React cannot distinguish them during reconciliation, leading to duplicate-key warnings and potentially corrupted component state. The id prop also falls back to '', giving multiple rows the same DOM id.

Performance: renderRow is not memoized, recreated every render

📄 openmetadata-ui/src/main/resources/ui/src/components/IncidentManager/IncidentManager.component.tsx:615-629
renderRow is a plain function that closes over multiple reactive values (testCasePermissions, isPermissionLoading, handleStatusSubmit, etc.). Because it's recreated on every render, the Table.Body's dependencies array alone controls re-rendering — but having a new function reference every time defeats React's ability to bail out of rendering children. Wrapping it in useCallback with the same deps used in dependencies would be more consistent.

Quality: Orphan CSS class 'failed-sample-data-column' has no definition

📄 openmetadata-ui/src/main/resources/ui/src/components/DataQuality/IncidentManager/FailedTestCaseSampleData/FailedTestCaseSampleData.component.tsx:292
The class failed-sample-data-column is applied at line 292 but has no corresponding style definition anywhere in the codebase (the .less file import was removed, and no global definition exists). Since Tailwind utility tw:bg-error-primary is already applied alongside it, the orphan class name is dead code that adds confusion.

...and 3 more resolved from earlier reviews

Options

Display: compact → Showing less information.

Comment with these commands to change:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 8, 2026

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

Labels

safe to test Add this label to run secure Github workflows on PRs UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants