refactor(ui): import table types from Table.interface, not AntD - #31955
Conversation
Every call site reached directly into `antd/lib/table` or `antd/es/table` for `ColumnsType` and friends, so the table implementation could not be changed without touching all of them. `Table.interface.ts` now re-exports the eleven types in use and is the single file that imports AntD's table typings; call sites import from there, and swapping the underlying table becomes a change to the right-hand side of those re-exports. Mechanical, type-only: no runtime behaviour changes. Two fixes to the shared codemod were needed to do it: - `move-named-imports` could only write one literal specifier via `--to`, but this destination is a file in the repo and openmetadata-ui has no `src` resolve root, so the relative depth differs per call site. Adds `--toPath`, which computes the specifier per file, skips the destination module itself, and leaves a default import behind when its named sibling moves. - Fixes a crash that predates this change: when every specifier of a declaration moved into an existing target, the declaration was removed, and the second pass of the kind loop then re-filtered a stale collection whose paths resolved to whatever shifted into the slot — `path.node.specifiers is not iterable`. It now re-queries the AST per pass. This silently skipped two files during the bulk run rather than failing loudly. `Key` was left out of the re-exports: AntD's is React's, so TopicSchema imports it from react directly. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
✅ Playwright Results — workflow succeededValidated commit ✅ 1206 passed · ❌ 0 failed · 🟡 3 flaky · ⏭️ 1 skipped · 🧰 0 lifecycle flaky PerformanceBlocking targets: ✅ met · Optimization targets: 🟡 in progress Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting. 🕒 Full workflow signal wall (to summary) 58m 57s ⏱️ Max setup 5m 37s · max shard execution 18m 57s · max shard-job elapsed before upload 22m 22s · reporting 7s 🌐 218.60 requests/attempt · 2.37 app boots/UI scenario · 33.16% common-shard skew Optimization targets still in progress:
🟡 3 flaky test(s) (passed on retry)
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
path.relative uses the platform separator, so a contributor running the transform on Windows would get specifiers like ..\components\common\Table\ Table.interface written into every touched file — invalid, and silent. The 'climbs out of nested directories' test already asserts the exact specifier, so it guards this on a Windows runner; on posix path.sep is already '/' and the normalization is a no-op.
|
| Count | Rule |
|---|---|
| 215 | react-hooks/exhaustive-deps |
| 14 | sonarjs/cyclomatic-complexity |
| 14 | sonarjs/no-duplicate-string |
| 10 | sonarjs/expression-complexity |
| 8 | openmetadata-imports/no-lower-layer-page-imports |
| 8 | sonarjs/no-nested-functions |
| 6 | sonarjs/no-nested-conditional |
| 3 | i18next/no-literal-string |
| 3 | sonarjs/cognitive-complexity |
| 3 | react/no-unstable-nested-components |
All findings
| Location | Rule | Message | |
|---|---|---|---|
| 🟡 | src/components/APIEndpoint/APIEndpointSchema/APIEndpointSchema.tsx:471:5 |
react-hooks/exhaustive-deps |
React Hook useMemo has a missing dependency: 't'. Either include it or remove the dependency array. |
| 🟡 | src/components/Classifications/ClassificationDetails/ClassificationDetails.tsx:109:5 |
sonarjs/cyclomatic-complexity |
{"message":"Function has a complexity of 15 which is greater than 10 authorized.","cost":5,"secondaryLocations":[{"line":109,"column":4,"endLine":109,"endColumn |
| 🟡 | src/components/Classifications/ClassificationDetails/ClassificationDetails.tsx:203:8 |
react-hooks/exhaustive-deps |
React Hook useCallback has missing dependencies: 'isVersionView' and 'navigate'. Either include them or remove the dependency array. |
| 🟡 | src/components/Classifications/ClassificationDetails/ClassificationDetails.tsx:212:20 |
sonarjs/cyclomatic-complexity |
{"message":"Function has a complexity of 11 which is greater than 10 authorized.","cost":1,"secondaryLocations":[{"line":212,"column":19,"endLine":212,"endColum |
| 🟡 | src/components/Classifications/ClassificationDetails/ClassificationDetails.tsx:308:8 |
react-hooks/exhaustive-deps |
React Hook useMemo has a missing dependency: 't'. Either include it or remove the dependency array. |
| 🟡 | src/components/Classifications/ClassificationDetails/ClassificationDetails.tsx:389:8 |
react-hooks/exhaustive-deps |
React Hook useEffect has missing dependencies: 'fetchClassificationChildren', 'handlePageChange', and 'isAddingTag'. Either include them or remove the dependenc |
| 🟡 | src/components/Container/ContainerDataModel/ContainerDataModel.tsx:308:5 |
react-hooks/exhaustive-deps |
React Hook useMemo has missing dependencies: 't', 'tagFilter.Classification', and 'tagFilter.Glossary'. Either include them or remove the dependency array. Oute |
| 🟡 | src/components/Dashboard/DashboardChartTable/DashboardChartTable.tsx:103:6 |
react-hooks/exhaustive-deps |
React Hook useCallback has a missing dependency: 'getEntityPermission'. Either include it or remove the dependency array. |
| 🟡 | src/components/Dashboard/DashboardChartTable/DashboardChartTable.tsx:128:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has missing dependencies: 'fetchChartPermissions' and 't'. Either include them or remove the dependency array. |
| 🟡 | src/components/Dashboard/DashboardChartTable/DashboardChartTable.tsx:135:6 |
react-hooks/exhaustive-deps |
React Hook useEffect has a missing dependency: 'getAllChartsPermissions'. Either include it or remove the dependency array. |
| 🟡 | src/components/Dashboard/DashboardChartTable/DashboardChartTable.tsx:152:6 |
react-hooks/exhaustive-deps |
React Hook useCallback has a missing dependency: 't'. Either include it or remove the dependency array. |
| 🟡 | src/components/Dashboard/DashboardChartTable/DashboardChartTable.tsx:287:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has an unnecessary dependency: 'chartFilters'. Either exclude it or remove the dependency array. |
| 🟡 | src/components/Dashboard/DashboardChartTable/DashboardChartTable.tsx:403:5 |
react-hooks/exhaustive-deps |
React Hook useMemo has missing dependencies: 'dashboardDetails?.fullyQualifiedName', 'hasEditGlossaryTermAccess', 't', 'tagFilter.Classification', and 'tagFilte |
| 🟡 | src/components/Dashboard/DashboardVersion/DashboardVersion.component.tsx:143:5 |
react-hooks/exhaustive-deps |
React Hook useMemo has a missing dependency: 't'. Either include it or remove the dependency array. |
| 🟡 | src/components/Dashboard/DashboardVersion/DashboardVersion.component.tsx:247:5 |
react-hooks/exhaustive-deps |
React Hook useMemo has missing dependencies: 'dataProducts', 'domains', 't', and 'tags'. Either include them or remove the dependency array. |
| 🟡 | src/components/Dashboard/DataModel/DataModels/DataModelsTable.tsx:40:1 |
openmetadata-imports/no-lower-layer-page-imports |
Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here. |
| 🟡 | src/components/Dashboard/DataModel/DataModels/DataModelsTable.tsx:128:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has a missing dependency: 'pageSize'. Either include it or remove the dependency array. |
| 🟡 | src/components/Dashboard/DataModel/DataModels/DataModelsTable.tsx:195:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has a missing dependency: 'handlePagingChange'. Either include it or remove the dependency array. |
| 🟡 | src/components/Dashboard/DataModel/DataModels/DataModelsTable.tsx:239:6 |
react-hooks/exhaustive-deps |
React Hook useEffect has a missing dependency: 'searchDataModels'. Either include it or remove the dependency array. |
| 🟡 | src/components/Dashboard/DataModel/DataModels/DataModelsTable.tsx:252:6 |
react-hooks/exhaustive-deps |
React Hook useEffect has a missing dependency: 'fetchDashboardsDataModel'. Either include it or remove the dependency array. |
| 🟡 | src/components/Dashboard/DataModel/DataModels/ModelTab/ModelTab.component.tsx:167:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has an unnecessary dependency: 'paging'. Either exclude it or remove the dependency array. |
| 🟡 | src/components/Dashboard/DataModel/DataModels/ModelTab/ModelTab.component.tsx:191:6 |
react-hooks/exhaustive-deps |
React Hook useMemo has a missing dependency: 'deleted'. Either include it or remove the dependency array. |
| 🟡 | src/components/Dashboard/DataModel/DataModels/ModelTab/ModelTab.component.tsx:213:9 |
react-hooks/exhaustive-deps |
The 'updateColumnDetails' function makes the dependencies of useCallback Hook (at line 242) change on every render. To fix this, wrap the definition of 'updateC |
| 🟡 | src/components/Dashboard/DataModel/DataModels/ModelTab/ModelTab.component.tsx:213:9 |
react-hooks/exhaustive-deps |
The 'updateColumnDetails' function makes the dependencies of useCallback Hook (at line 259) change on every render. To fix this, wrap the definition of 'updateC |
| 🟡 | src/components/Dashboard/DataModel/DataModels/ModelTab/ModelTab.component.tsx:443:5 |
react-hooks/exhaustive-deps |
React Hook useMemo has a missing dependency: 't'. Either include it or remove the dependency array. |
| 🟡 | src/components/DataContract/ContractQualityFormTab/ContractQualityFormTab.tsx:93:9 |
react-hooks/exhaustive-deps |
The 'fetchAllTests' function makes the dependencies of useCallback Hook (at line 127) change on every render. To fix this, wrap the definition of 'fetchAllTests |
| 🟡 | src/components/DataContract/ContractQualityFormTab/ContractQualityFormTab.tsx:93:9 |
react-hooks/exhaustive-deps |
The 'fetchAllTests' function makes the dependencies of useCallback Hook (at line 141) change on every render. To fix this, wrap the definition of 'fetchAllTests |
| 🟡 | src/components/DataContract/ContractQualityFormTab/ContractQualityFormTab.tsx:166:5 |
react-hooks/exhaustive-deps |
React Hook useMemo has a missing dependency: 't'. Either include it or remove the dependency array. |
| 🟡 | src/components/DataContract/ContractQualityFormTab/ContractQualityFormTab.tsx:210:6 |
react-hooks/exhaustive-deps |
React Hook useEffect has a missing dependency: 'fetchAllTests'. Either include it or remove the dependency array. |
| 🟡 | src/components/DataContract/ContractSchemaFormTab/ContractScehmaFormTab.tsx:160:6 |
react-hooks/exhaustive-deps |
React Hook useMemo has a missing dependency: 'entityType'. Either include it or remove the dependency array. |
| 🟡 | src/components/DataContract/ContractSchemaFormTab/ContractScehmaFormTab.tsx:201:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has a missing dependency: 'handlePagingChange'. Either include it or remove the dependency array. |
| 🟡 | src/components/DataContract/ContractSchemaFormTab/ContractScehmaFormTab.tsx:243:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has missing dependencies: 'oldRemovedColumns' and 'selectedSchema'. Either include them or remove the dependency array. If 'setAllColumns |
| 🟡 | src/components/DataContract/ContractSchemaFormTab/ContractScehmaFormTab.tsx:271:6 |
react-hooks/exhaustive-deps |
React Hook useCallback has missing dependencies: 'oldRemovedColumns' and 'selectedSchema'. Either include them or remove the dependency array. If 'setAllColumns |
| 🟡 | src/components/DataContract/ContractSchemaFormTab/ContractScehmaFormTab.tsx:273:9 |
react-hooks/exhaustive-deps |
The 'fetchApiEndPointColumns' function makes the dependencies of useCallback Hook (at line 329) change on every render. Move it inside the useCallback callback. |
| 🟡 | src/components/DataContract/ContractSchemaFormTab/ContractScehmaFormTab.tsx:491:5 |
react-hooks/exhaustive-deps |
React Hook useMemo has a missing dependency: 't'. Either include it or remove the dependency array. |
| 🟡 | src/components/DataContract/ContractSchemaFormTab/ContractScehmaFormTab.tsx:531:6 |
react-hooks/exhaustive-deps |
React Hook useEffect has a missing dependency: 'fetchColumnsBasedOnEntity'. Either include it or remove the dependency array. |
| 🟡 | src/components/DataContract/ContractSchemaTable/ContractSchemaTable.component.tsx:122:5 |
react-hooks/exhaustive-deps |
React Hook useMemo has a missing dependency: 't'. Either include it or remove the dependency array. |
| 🟡 | src/components/DataInsight/TopActiveUsers.tsx:67:6 |
react-hooks/exhaustive-deps |
React Hook useEffect has a missing dependency: 'fetchMostActiveUsers'. Either include it or remove the dependency array. |
| 🟡 | src/components/DataInsight/TopActiveUsers.tsx:117:5 |
react-hooks/exhaustive-deps |
React Hook useMemo has a missing dependency: 't'. Either include it or remove the dependency array. |
| 🟡 | src/components/DataInsight/TopViewEntities.tsx:66:6 |
react-hooks/exhaustive-deps |
React Hook useEffect has a missing dependency: 'fetchMostViewedEntities'. Either include it or remove the dependency array. |
| 🟡 | src/components/DataInsight/TopViewEntities.tsx:115:5 |
react-hooks/exhaustive-deps |
React Hook useMemo has a missing dependency: 't'. Either include it or remove the dependency array. |
| 🟡 | src/components/Database/DatabaseSchema/DatabaseSchemaTable/DatabaseSchemaTable.tsx:163:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has a missing dependency: 'handlePagingChange'. Either include it or remove the dependency array. |
| 🟡 | src/components/Database/DatabaseSchema/DatabaseSchemaTable/DatabaseSchemaTable.tsx:193:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has a missing dependency: 'pageSize'. Either include it or remove the dependency array. |
| 🟡 | src/components/Database/DatabaseSchema/DatabaseSchemaTable/DatabaseSchemaTable.tsx:202:6 |
react-hooks/exhaustive-deps |
React Hook useCallback has missing dependencies: 'handlePageChange' and 'setFilters'. Either include them or remove the dependency array. |
| 🟡 | src/components/Database/DatabaseSchema/DatabaseSchemaTable/DatabaseSchemaTable.tsx:305:5 |
react-hooks/exhaustive-deps |
React Hook useMemo has a missing dependency: 'searchValue'. Either include it or remove the dependency array. |
| 🟡 | src/components/Database/DatabaseSchema/DatabaseSchemaTable/DatabaseSchemaTable.tsx:341:6 |
react-hooks/exhaustive-deps |
React Hook useEffect has a missing dependency: 'fetchDatabaseSchema'. Either include it or remove the dependency array. |
| 🟡 | src/components/Database/SchemaTable/SchemaTable.component.tsx:359:6 |
react-hooks/exhaustive-deps |
React Hook useEffect has a missing dependency: 'fetchTestCaseSummary'. Either include it or remove the dependency array. |
| 🟡 | src/components/Database/SchemaTable/SchemaTable.component.tsx:461:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has a missing dependency: 'tableFqn'. Either include it or remove the dependency array. |
| 🟡 | src/components/Database/SchemaTable/SchemaTable.component.tsx:670:38 |
i18next/no-literal-string |
disallow literal string: {t('label.alphabetical')} (A → Z) |
| 🟡 | src/components/Database/SchemaTable/SchemaTable.component.tsx:674:62 |
i18next/no-literal-string |
disallow literal string: ✓ |
… and 249 more. Run make ui-checkstyle-changed locally for the full list.
Fix locally (fast - only checks files changed in this branch):
make ui-checkstyle-changedtw-guard's regex is import\s+([^'";]*?)\s+from\s+['"](antd…) with the /s flag, so the clause can span newlines. The word 'import' in the comment above the re-exports, with no quote or semicolon between it and the 'antd/lib/table/ interface' specifier, made an export statement look like a new antd import. The guard never matches 'export … from', so the re-export itself was fine — only the wording above it needed to change.
Code Review ✅ Approved 1 resolved / 1 findingsCentralizes UI Ant Design table typings behind Table.interface.ts and updates consumers to import from the shared boundary, accompanied by codemod improvements for relative path handling and stale AST collection fixes. No issues found. ✅ 1 resolved✅ Quality: relativeSpecifier emits backslashes on Windows
OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
🚦 Removed from the merge queue —
|



Fixes 6029
Independent of #31953 / #31954 — reviewable and mergeable on its own.
Every call site reached directly into
antd/lib/tableorantd/es/tableforColumnsTypeand friends, so the table implementation could not be changed without touching all of them.Table.interface.tsnow re-exports the eleven types in use and is the only file that imports AntD's table typings.Swapping the underlying table becomes a change to the right-hand side of those re-exports instead of ~100 files.
Mechanical and type-only — no runtime behaviour changes. 76 files.
Two fixes to the shared codemod were needed
--toPath—move-named-importscould only write one literal specifier via--to, but this destination is a file in the repo andopenmetadata-uihas nosrcresolve root, so the relative depth differs per call site.--toPathcomputes the specifier per file, skips the destination module itself, and leaves a default import behind when its named sibling moves.path.node.specifiers is not iterable). It now re-queries the AST per pass. This silently skipped two files during the bulk run rather than failing loudly — caught only by grepping for what should have been gone.Both have regression tests; the codemod package is 87/87. Its dependencies were not installed, so all three of its suites were failing before this change — worth a look if CI ever reports that tooling as green.
Notes
Keyis deliberately not re-exported — AntD'sKeyis React's, soTopicSchemaimports it from react directly.Verification
git grep "antd/es/table\|antd/lib/table"insrc/→ onlyTable.interface.tsitselftsc --noEmit: 573 errors, identical tomain— zero deltaeslinton all 76 changed files: 0 errors🤖 Generated with Claude Code
Greptile Summary
This PR centralizes Ant Design table typings behind
Table.interface.tsand updates UI consumers to use that shared type boundary.--toPathsupport and stale-AST regression handling to the import-migration codemod.Confidence Score: 5/5
The PR appears safe to merge.
No blocking failure remains.
Important Files Changed
Reviews (3): Last reviewed commit: "fix(ui): stop tw-guard matching a commen..." | Re-trigger Greptile