Skip to content

Fixes #33951: key-based CommonWidgets, respect widget size, fix tab flicker - #33952

Merged
chirag-madlani merged 4 commits into
mainfrom
analyse-commonwidgets-closure-issue
Sep 24, 2026
Merged

chirag-madlani merged 4 commits into
mainfrom
analyse-commonwidgets-closure-issue

Conversation

@chirag-madlani

@chirag-madlani chirag-madlani commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

Describe your changes:

Fixes #33951

I split the monolithic CommonWidgets into a key-based registry of per-widget components, because every render initialised all widget closures regardless of widget type and resolved keys by prefix, so config could reach the wrong widget. I also made widgets respect the Small/Large size picked when adding them (recorded as config.size, now preserved through react-grid-layout updates), and stopped an unrendered tab pane from writing a 0 height into the shared layout, which caused the LeftPanel flicker and unresponsive tab clicks.

Type of change:

  • Improvement

High-level design:

  • Registry + dispatcher: CommonWidgets.tsx resolves widgetConfig.i (exact match, or a -<n> instance suffix) against COMMON_WIDGET_REGISTRY and mounts only the matching component from widgets/. Unregistered keys fall back to commonWidgetClassBase. Shared derivations live in CommonWidgets.hooks.tsx, and the glossary-term tag confirmation state now lives inside the tag widgets.
  • Widget size meta: getAddWidgetHandler stores config.size ('small' | 'large') on new widgets. A new mergeGridLayout keeps widget-owned fields (config, children) when CustomizeTabWidget applies react-grid-layout's onLayoutChange output, which only has grid fields. DescriptionWidget shows the full description for Large and clamps behind "read more" for Small. It uses the existing free-form WidgetConfig.config / page layout JSON, so there's no schema change, and existing layouts behave as before.
  • DynamicHeightWidget: skips 0×0 ResizeObserver entries, because a widget that isn't rendered has an unknown height, not zero. With core Tabs (refactor(ui): migrate entity details and version page tabs to core Tabs #33890) only one panel mounts, so this is now defensive.
  • Alternatives rejected: height-based sizing (heights are content-measured); reusing w (its meaning differs between the main grid and the left panel); a provider-level height cache (leaked heights across tabs).

Tests:

Use cases covered

  • Each common widget key renders only its own widget; unknown keys use the extension fallback
  • Tags edit permission: an explicit deny beats EditAll
  • Adding a widget records its Small/Large size, and the size survives layout changes
  • A Large Description renders in full; a Small one clamps behind "read more"
  • A hidden (0×0) widget measurement doesn't update the layout

Unit tests

  • CommonWidgets.test.tsx, DynamicHeightWidget.test.tsx, CustomizePageWidgetUtils.test.ts (new). All 28 customization-related suites pass (287 tests), plus the GenericProvider and TableDetailsPageV1 suites.
  • Line coverage on changed files: 79% total (DynamicHeightWidget, CommonWidgets, registry, utils: 100%; DescriptionWidget: 60%; CustomizePageWidgetUtils: 52%, mostly pre-existing untested code)

Backend integration tests

  • Not applicable (no backend changes)

Ingestion integration tests

  • Not applicable (no ingestion changes)

Playwright (UI) tests

  • Existing entity-details and customization specs cover these widgets; none added.

Manual testing performed

  1. Created a persona with two custom Table tabs (Description / Description non expanded) and assigned it to admin
  2. Switched Columns ↔ Description ↔ Activity: no LeftPanel collapse, every tab click switches
  3. Added a Description widget as Small and as Large, saved, and checked read-more vs full content

UI screen recording / screenshots:

Before:
Screen.Recording.2026-09-24.at.4.22.53.PM.mov
After:
Screen.Recording.2026-09-24.at.4.21.41.PM.mov

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • For UI changes: I attached a screen recording and/or screenshots above.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.

Split the monolithic CommonWidgets into one component per widget key so each
widget only initialises its own hooks and closures, and resolve keys exactly
instead of by prefix. Stop DynamicHeightWidget from reporting a 0x0 measurement
from an unrendered pane into the shared layout (it collapsed the visible
LeftPanel and ping-ponged on persona tab switches), and record the picked
small/large size on new widgets so Description renders full vs read-more
independent of its content-measured height.
…hange

onLayoutChange returns only grid fields, so the customize page replaced each
widget with a bare Layout and dropped widget-owned fields such as config.size
right after a widget was added. Merge RGL's positions onto the stored widgets
by id in both the main grid and the left panel handlers.
@github-actions github-actions Bot added safe to test Add this label to run secure Github workflows on PRs UI UI specific issues labels Sep 24, 2026
@chirag-madlani
chirag-madlani marked this pull request as ready for review September 24, 2026 10:49
@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR checks passed

The linked issue has a description and all required Shipping project fields set. Thanks!

@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ UI Checkstyle passed — lint findings in changed files

🔍 ESLint findings in this PR's files — 0 error(s), 27 warning(s)

Errors block the build. Warnings do not yet — they are rules whose backlog is still
being worked down, listed so this PR does not add to it. See docs/ui-code-quality-gate.md.

0 error(s), 27 warning(s) across 9 changed file(s).

Count Rule
10 openmetadata-imports/no-lower-layer-page-imports
9 openmetadata-imports/no-circular-imports
5 react-hooks/exhaustive-deps
3 no-restricted-imports
All findings
Location Rule Message
🟡 src/components/Customization/CustomizeTabWidget/CustomizeTabWidget.tsx:30: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/Customization/CustomizeTabWidget/CustomizeTabWidget.tsx:34: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/Customization/CustomizeTabWidget/CustomizeTabWidget.tsx:130:6 react-hooks/exhaustive-deps React Hook useMemo has a missing dependency: 'currentPageType'. Either include it or remove the dependency array.
🟡 src/components/Customization/CustomizeTabWidget/CustomizeTabWidget.tsx:254:5 react-hooks/exhaustive-deps React Hook useCallback has missing dependencies: 'activeKey', 'currentPage', 'items', and 'updateCurrentPage'. Either include them or remove the dependency arra
🟡 src/components/Customization/CustomizeTabWidget/CustomizeTabWidget.tsx:319:5 react-hooks/exhaustive-deps React Hook useMemo has a missing dependency: 'getWidgetFromLayout'. Either include it or remove the dependency array.
🟡 src/components/Customization/CustomizeTabWidget/CustomizeTabWidget.tsx:345:5 react-hooks/exhaustive-deps React Hook useCallback has missing dependencies: 'activeKey', 'currentPage', 'items', and 'updateCurrentPage'. Either include them or remove the dependency arra
🟡 src/components/Customization/CustomizeTabWidget/CustomizeTabWidget.tsx:370:5 react-hooks/exhaustive-deps React Hook useCallback has missing dependencies: 'activeKey', 'currentPage', 'currentPageType', 'items', and 'updateCurrentPage'. Either include them or remove
🟡 src/components/Customization/GenericTab/DynamicHeightWidget.test.tsx:15: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/Customization/GenericTab/DynamicHeightWidget.tsx:18: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/utils/CustomizePage/CustomizePageWidgetUtils.ts:21: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/utils/CustomizePage/CustomizePageWidgetUtils.ts:23:1 openmetadata-imports/no-circular-imports This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency.
🟡 src/utils/DashboardDataModelUtils.tsx:25:1 openmetadata-imports/no-circular-imports This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency.
🟡 src/utils/DashboardDataModelUtils.tsx:33: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/utils/DashboardDataModelUtils.tsx:34:1 openmetadata-imports/no-circular-imports This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency.
🟡 src/utils/EntityVersionUtils.interface.ts:25: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/utils/MlModelDetailsUtils.tsx:23:1 openmetadata-imports/no-circular-imports This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency.
🟡 src/utils/MlModelDetailsUtils.tsx:29: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/utils/MlModelDetailsUtils.tsx:31:1 openmetadata-imports/no-circular-imports This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency.
🟡 src/utils/PipelineDetailsUtils.tsx:16:1 no-restricted-imports '../assets/svg/fail-badge.svg' import is restricted from being used by a pattern. Do not import SVG icons directly from assets/ paths; use the designated abstra
🟡 src/utils/PipelineDetailsUtils.tsx:17:1 no-restricted-imports '../assets/svg/skipped-badge.svg' import is restricted from being used by a pattern. Do not import SVG icons directly from assets/ paths; use the designated abs
🟡 src/utils/PipelineDetailsUtils.tsx:18:1 no-restricted-imports '../assets/svg/success-badge.svg' import is restricted from being used by a pattern. Do not import SVG icons directly from assets/ paths; use the designated abs
🟡 src/utils/PipelineDetailsUtils.tsx:28:1 openmetadata-imports/no-circular-imports This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency.
🟡 src/utils/PipelineDetailsUtils.tsx:35: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/utils/PipelineDetailsUtils.tsx:37:1 openmetadata-imports/no-circular-imports This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency.
🟡 src/utils/SearchIndexUtils.tsx:27:1 openmetadata-imports/no-circular-imports This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency.
🟡 src/utils/SearchIndexUtils.tsx:35: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/utils/SearchIndexUtils.tsx:37:1 openmetadata-imports/no-circular-imports This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency.

Fix locally (fast - only checks files changed in this branch):

make ui-checkstyle-changed

@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 72%
72.92% (105533/144713) 58.25% (64565/110828) 59.32% (21204/35742)

@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit 25f5214597198a05b6d265f741b8a363c42c75fe in Playwright run 36015264003, attempt 1.

✅ 4580 passed · ❌ 0 failed · 🟡 6 flaky · ⏭️ 1 skipped · 🧰 0 lifecycle flaky

Performance

Blocking 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) 1h 1m 17s

⏱️ Max setup 4m 53s · max shard execution 22m 12s · max shard-job elapsed before upload 26m 24s · reporting 22s

🌐 128.58 requests/attempt · 2.24 app boots/UI scenario · 30.03% common-shard skew

Optimization targets still in progress:

  • Common shard skew was 30.03% (convergence target: at most 15%).
  • Application boot ratio was 2.24 per UI scenario (10916 boots / 4876 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
🟡 Shard advanced-search-01 129 0 1 0 0 0
🟡 Shard chromium-01 167 0 1 0 0 0
✅ Shard chromium-02 168 0 0 0 0 0
✅ Shard chromium-03 178 0 0 0 0 0
✅ Shard chromium-04 208 0 0 0 0 0
✅ Shard chromium-05 190 0 0 0 0 0
✅ Shard chromium-06 159 0 0 0 0 0
✅ Shard chromium-07 166 0 0 0 0 0
✅ Shard chromium-08 165 0 0 0 0 0
🟡 Shard chromium-09 177 0 1 0 0 0
✅ Shard chromium-10 196 0 0 0 0 0
✅ Shard chromium-11 158 0 0 0 0 0
✅ Shard chromium-12 168 0 0 0 0 0
✅ Shard chromium-13 168 0 0 0 0 0
🟡 Shard chromium-14 152 0 1 0 0 0
✅ Shard chromium-15 163 0 0 0 0 0
✅ Shard chromium-16 198 0 0 0 0 0
✅ Shard chromium-17 185 0 0 0 0 0
✅ Shard chromium-18 166 0 0 0 0 0
✅ Shard chromium-19 145 0 0 0 0 0
✅ Shard chromium-20 175 0 0 0 0 0
✅ Shard chromium-21 170 0 0 1 0 0
✅ Shard chromium-22 174 0 0 0 0 0
✅ Shard chromium-23 209 0 0 0 0 0
🟡 Shard data-asset-rules-01 64 0 1 0 0 0
✅ Shard domain-isolation-01 16 0 0 0 0 0
✅ Shard global-state-01 34 0 0 0 0 0
✅ Shard import-export-01 51 0 0 0 0 0
🟡 Shard import-export-02 98 0 1 0 0 0
✅ Shard ingestion-01 46 0 0 0 0 0
✅ Shard ingestion-02 55 0 0 0 0 0
✅ Shard reindex-01 41 0 0 0 0 0
✅ Shard search-01 12 0 0 0 0 0
✅ Shard search-rbac-01 29 0 0 0 0 0
🟡 6 flaky test(s) (passed on retry)
  • Features/AdvancedSearch.spec.ts › Verify Group functionality for field Data Model Type with OR operator (shard advanced-search-01, 1 retry)
  • Pages/ExplorePageRightPanel.spec.ts › Should perform CRUD and Removal operations for topic (shard chromium-01, 1 retry)
  • Features/Glossary/GlossaryMutualExclusivity.spec.ts › ME-S01: Selecting ME child should auto-deselect siblings (shard chromium-09, 1 retry)
  • Features/ContextCenterDashboard.spec.ts › Create > Quick Link creates a quick link that appears in the Articles pillar card recent list (shard chromium-14, 1 retry)
  • Features/DataAssetRulesDisabled.spec.ts › should allow multiple domain selection for glossary term when entity rules are disabled (shard data-asset-rules-01, 1 retry)
  • Features/BulkEditImportPermissions.spec.ts › Editor with EditAll can access every bulk edit and import page (shard import-export-02, 1 retry)

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

…gets

Break the import cycles that reached CommonWidgets through TablePureUtils by
moving the pure extract* helpers it used out of the JSX util modules, and drop
two runtime imports that only carried types. Move WidgetConfig to the interface
layer (pages re-exports it) so the widgets no longer import from pages. Add
tests for the hooks, Description, Owner, DataProducts and LeftPanel widgets
and the remaining widget keys, bringing every new file to full line coverage.
@gitar-bot

gitar-bot Bot commented Sep 24, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 1 closed / 1 findings

🟡 Medium risk · Refactors entity detail widgets and changes saved layout sizing and tab behavior

Refactors CommonWidgets into a key-based registry to prevent widget closure initialization and config misrouting, adds widget size preservation through layout updates, and fixes LeftPanel flicker by skipping unmeasured (0×0) widget entries. Addresses the default-expanded description read-less toggle issue. No open issues found.

✅ 1 closed
✅ Bug: Default-expanded descriptions lose their read-less toggle

📄 openmetadata-ui/src/main/resources/ui/src/components/DataAssets/CommonWidgets/widgets/DescriptionWidget.tsx:87-101
The old widget passed isDescriptionExpanded to Description and set removeBlur only for Domain. The description then opened expanded but kept the see-more/less toggle. RichTextEditorPreviewerV1 seeds readMore from isDescriptionExpanded and shows the toggle only while enableSeeMoreVariant (!removeBlur) is true. The new widget drops the isDescriptionExpanded prop and folds the value into removeBlur. So a Small widget on an entity that opens expanded by default no longer has a toggle, and a long description can't be collapsed. This affects, for example, a table with no columns, an empty pipeline, or a Metric/File/Worksheet. This change isn't described in the PR. Keep the two concerns separate: pass isDescriptionExpanded as before, and let only isLarge or Domain set removeBlur.

Review coverage

📋 Rules No rules evaluated

🧪 Functional validation Not enabled · Set up

🤖 Auto-approval Not enabled · Set up

Options

Display: compact → Counting what did not apply, without listing it.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@sonarqubecloud

Copy link
Copy Markdown

This branch was previously deployed

1 inactive deployment
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.

Customized detail page tabs: widget size (small/large) not respected, and LeftPanel flickers on tab switch

3 participants