Skip to content

Fixes #29815: Fix fitView not centering the lineage DAG - #30163

Merged
chirag-madlani merged 3 commits into
mainfrom
lineage-fitview-bug
Jul 17, 2026
Merged

chirag-madlani merged 3 commits into
mainfrom
lineage-fitview-bug

Conversation

@chirag-madlani

@chirag-madlani chirag-madlani commented Jul 17, 2026 •

Copy link
Copy Markdown
Collaborator

Describe your changes:

Fixes #29815

The handleFitView callback was capturing the current zoom level, calling fitView() to fit all nodes, then immediately overriding the calculated zoom with zoomTo(currentZoom) — restoring the user's previous zoom and making "Fit to Screen" ineffective. The graph would shift erratically but never actually scale to fit the viewport.

Changes:

  • Removed the zoomTo override so fitView retains its calculated center and scale
  • Added maxZoom: 1 to prevent over-zooming on small graphs
  • Cleaned up Dropdown.Root to use built-in open/close behavior (removed manual state and triggerRef)
  • Fixed react-flow panel margins and positioning for better layout
  • Updated Playwright lineage tests to use a new fitToScreen helper instead of performZoomOut

Type of change:

  • Bug fix
  • Improvement
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation

High-level design:

N/A — small change.

Tests:

Use cases covered

  • User clicks "Fit to screen" on a lineage DAG with many nodes — graph scales down and centers to show all nodes
  • User clicks "Fit to screen" on a small graph (2-3 nodes) — graph centers without zooming past 100%

Unit tests

  • I added unit tests for the new/changed logic.
  • Files updated: LineageControlButtons.test.tsx — removed obsolete mockZoomTo/getZoom mocks, updated fitView assertion to expect { padding: 0.2, maxZoom: 1 }
  • All 14 tests passing

Backend integration tests

  • Not applicable (no backend API changes).

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • I added Playwright E2E tests under openmetadata-ui/.../ui/playwright/ for UI changes.
  • Files updated:
    • playwright/utils/lineage.ts — added fitToScreen helper
    • playwright/e2e/Pages/Lineage/DataAssetLineage.spec.ts — replaced performZoomOut with fitToScreen
    • playwright/e2e/Pages/Lineage/LineageFilters.spec.ts — replaced performZoomOut with fitToScreen

Manual testing performed

  1. Opened lineage view with default depth (2x2), clicked "Fit to screen" — all nodes visible and centered
  2. Increased upstream depth to 5, clicked "Fit to screen" — graph properly scaled down to fit viewport
  3. Enabled column view, clicked "Fit to screen" — graph correctly fits with expanded column nodes

UI screen recording / screenshots:

Screen.Recording.2026-07-17.at.11.35.56.AM.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 JSON Schema changes: I updated the migration scripts or explained why it is not needed.
  • 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.
  • I have added a test that covers the exact scenario we are fixing.

🤖 Generated with Claude Code

Greptile Summary

This PR fixes the lineage DAG fit-to-screen behavior and updates the related controls and tests. The main changes are:

  • Keeps the center and zoom calculated by React Flow, capped at 100% zoom.
  • Uses the dropdown component's built-in open and close behavior.
  • Adjusts lineage panel spacing and positioning.
  • Updates unit and Playwright tests to use the fit-to-screen action.

Confidence Score: 5/5

This looks safe to merge.

  • The fit-to-screen action no longer restores the previous zoom after fitting the graph.
  • The dropdown uses the supported built-in trigger behavior.
  • No blocking issues were found in the updated code.

Important Files Changed

Filename Overview
openmetadata-ui/src/main/resources/ui/src/components/Entity/EntityLineage/LineageControlButtons/LineageControlButtons.tsx Fixes fit-to-screen zoom behavior and simplifies dropdown state handling.
openmetadata-ui/src/main/resources/ui/src/components/Entity/EntityLineage/LineageControlButtons/LineageControlButtons.test.tsx Updates the fit-view assertion and removes obsolete zoom mocks.
openmetadata-ui/src/main/resources/ui/playwright/utils/lineage.ts Adds a helper that invokes the lineage fit-to-screen menu action.
openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Lineage/DataAssetLineage.spec.ts Uses fit-to-screen in data asset lineage workflows.
openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Lineage/LineageFilters.spec.ts Uses fit-to-screen when validating filtered lineage graphs.
openmetadata-ui/src/main/resources/ui/src/components/Entity/EntityLineage/entity-lineage.style.less Adjusts lineage container height and React Flow panel offsets.

Reviews (3): Last reviewed commit: "Fix missing fitToScreen import and remov..." | Re-trigger Greptile

Context used (3)

  • Context used - CLAUDE.md (source)
  • Context used - openmetadata-ui-core-components/CLAUDE.md (source)
  • Context used - AGENTS.md (source)

The handleFitView callback was immediately overriding the zoom level
calculated by fitView() with the user's previous zoom via zoomTo(),
making the fit-to-screen action ineffective. Remove the zoomTo override
and add maxZoom: 1 to prevent over-zooming on small graphs.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings July 17, 2026 05:14
@chirag-madlani
chirag-madlani requested a review from a team as a code owner July 17, 2026 05:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Jul 17, 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 added safe to test Add this label to run secure Github workflows on PRs UI UI specific issues labels Jul 17, 2026
@github-actions

github-actions Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 64%
64.99% (75614/116341) 48.8% (45029/92260) 49.59% (13632/27486)

…ight to use fitToScreen

Remove manual Dropdown open/close state and triggerRef in favor of built-in
Dropdown.Root behavior. Adjust react-flow panel margins and positioning.
Update Playwright lineage tests to use fitToScreen helper instead of
performZoomOut for more reliable node visibility.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings July 17, 2026 06:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

- Replace performZoomOut with fitToScreen in LineageFilters.spec.ts import
- Sort imports alphabetically in DataAssetLineage.spec.ts
- Remove unused useRef and useState imports from LineageControlButtons.tsx

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings July 17, 2026 06:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

🟡 Playwright Results — all passed (31 flaky)

✅ 4538 passed · ❌ 0 failed · 🟡 31 flaky · ⏭️ 95 skipped

Shard Passed Failed Flaky Skipped
🟡 Shard 1 437 0 3 16
✅ Shard 2 11 0 0 0
🟡 Shard 3 819 0 13 8
🟡 Shard 4 819 0 3 18
🟡 Shard 5 838 0 2 5
🟡 Shard 6 787 0 1 46
🟡 Shard 7 827 0 9 2
🟡 31 flaky test(s) (passed on retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab IS visible for supported type: metric (shard 1, 1 retry)
  • Pages/SearchSettings.spec.ts › Latest preview config wins when a superseded request resolves late (shard 1, 1 retry)
  • Flow/SearchRBAC.spec.ts › a fully denied user sees neither asset type when browsing (shard 1, 1 retry)
  • Features/BulkImportWithDotInName.spec.ts › Bulk edit existing entity with dot in service name (shard 3, 1 retry)
  • Features/ColumnBulkOperations.spec.ts › should show Service filter chip from URL (shard 3, 1 retry)
  • Features/ColumnBulkOperations.spec.ts › should navigate through pages (shard 3, 1 retry)
  • Features/ContextCenterArchive.spec.ts › archive page lazy-loads more rows on scroll within its own scroll container (shard 3, 1 retry)
  • Features/ContextCenterArticles.spec.ts › Article listing search filters, clears, and shows empty state (shard 3, 1 retry)
  • Features/ContextCenterArticles.spec.ts › Article list cards, recently viewed widget, and pagination work (shard 3, 1 retry)
  • Features/ContextCenterArticles.spec.ts › description: switching articles does not bleed unsaved content into next article (shard 3, 1 retry)
  • Features/ContextCenterMemories.spec.ts › clearing search restores the unfiltered list (shard 3, 1 retry)
  • Features/ContextCenterPermission.spec.ts › user with deleteAll permission can see delete action but not restore action on an archived document, and can delete it (shard 3, 1 retry)
  • Features/ContextCenterPermission.spec.ts › created-by-me filter on the archive page shows only the current user's archived documents (shard 3, 1 retry)
  • Features/Glossary/GlossaryAdvancedOperations.spec.ts › should change domain on glossary (shard 3, 1 retry)
  • Features/Glossary/GlossaryHierarchy.spec.ts › should move term with children to different glossary (shard 3, 1 retry)
  • Features/Glossary/GlossaryHierarchy.spec.ts › should cancel drag and drop operation (shard 3, 1 retry)
  • Features/Glossary/GlossaryTermRelationsGraphNested.spec.ts › viewing a child term: parentOf edge is rendered between parent and child (shard 4, 1 retry)
  • Features/SearchExport.spec.ts › Export queues a background job and downloads from the jobs tray (shard 4, 1 retry)
  • Features/Table.spec.ts › should persist page size (shard 4, 1 retry)
  • Features/UserProfileOnlineStatus.spec.ts › Should show "Active recently" for users active within last hour (shard 5, 1 retry)
  • Flow/PersonaFlow.spec.ts › Set default persona for team should work properly (shard 5, 1 retry)
  • Pages/ExplorePageRightPanel_KnowledgeCenter.spec.ts › Should remove user owner for knowledgeCenter (shard 6, 1 retry)
  • Pages/ExplorePageRightPanel.spec.ts › Should allow Data Steward to edit tier for dashboardDataModel (shard 7, 1 retry)
  • Pages/GlossaryImportExport.spec.ts › Glossary Bulk Import Export (shard 7, 1 retry)
  • Pages/GlossaryImportExport.spec.ts › Import partial success - some terms pass, some fail (shard 7, 1 retry)
  • Pages/InputOutputPorts.spec.ts › Output ports section collapse/expand (shard 7, 1 retry)
  • Pages/Lineage/LineageFilters.spec.ts › Verify Impact Analysis service filter selection (shard 7, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab is NOT visible for pipelineService in platform lineage (shard 7, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab is NOT visible for apiService in platform lineage (shard 7, 1 retry)
  • Pages/TestSuite.spec.ts › Logical TestSuite (shard 7, 2 retries)
  • ... and 1 more

📦 Download artifacts

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

@chirag-madlani
chirag-madlani merged commit 3fc3975 into main Jul 17, 2026
58 of 59 checks passed
@chirag-madlani
chirag-madlani deleted the lineage-fitview-bug branch July 17, 2026 08:49
@gitar-bot

gitar-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 2 resolved / 2 findings

Removes the redundant zoom override to correctly center the lineage DAG, and standardizes test navigation with a new fit-to-screen helper. Unused imports and state management have been cleaned up.

✅ 2 resolved
✅ Bug: fitToScreen used but not imported in LineageFilters.spec.ts

📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Lineage/LineageFilters.spec.ts:37-44
In LineageFilters.spec.ts the 8 performZoomOut(page) calls were replaced with fitToScreen(page), but the import block (lines 37-44) still imports the now-unused performZoomOut and never adds fitToScreen. fitToScreen is therefore undefined, so the file fails to compile/lint and every test in it will error at runtime. Replace performZoomOut with fitToScreen in the import from '../../../utils/lineage'.

✅ Quality: Unused useRef/useState imports after Dropdown cleanup

📄 openmetadata-ui/src/main/resources/ui/src/components/Entity/EntityLineage/LineageControlButtons/LineageControlButtons.tsx:20
This commit removed the fitViewOpen/setFitViewOpen state and fitScreenRef, which were the only consumers of useState and useRef, but line 20 still imports both from 'react'. This will trip the no-unused-vars lint rule and fail CI. Remove useRef and useState from the import.

Options

Display: compact → Showing less information.

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

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

chirag-madlani added a commit that referenced this pull request Jul 20, 2026
* Fixes #29815: Fix fitView not centering the lineage DAG

The handleFitView callback was immediately overriding the zoom level
calculated by fitView() with the user's previous zoom via zoomTo(),
making the fit-to-screen action ineffective. Remove the zoomTo override
and add maxZoom: 1 to prevent over-zooming on small graphs.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

* Fixes #29815: Clean up Dropdown, fix panel spacing, and update Playwright to use fitToScreen

Remove manual Dropdown open/close state and triggerRef in favor of built-in
Dropdown.Root behavior. Adjust react-flow panel margins and positioning.
Update Playwright lineage tests to use fitToScreen helper instead of
performZoomOut for more reliable node visibility.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

* Fix missing fitToScreen import and remove unused React imports

- Replace performZoomOut with fitToScreen in LineageFilters.spec.ts import
- Sort imports alphabetically in DataAssetLineage.spec.ts
- Remove unused useRef and useState imports from LineageControlButtons.tsx

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
(cherry picked from commit 3fc3975)

This branch was previously deployed

1 inactive deployment
test — 7aebe615 Deployed Jul 17, 2026 by chirag-madlani via playwright-ci-postgresql (3, 7) #56978
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.

Lineage: "Fit to Screen" Malfunctioning

4 participants