Repository navigation
Description
Description
When opening the lineage view for an entity whose graph is larger than the viewport (e.g. a hub table with 19+ downstream nodes laid out in a tall column), the initial view does not fit the graph into the viewport. Instead, only the root node is centered at a fixed zoom, so most nodes and edges render outside the visible area. Users perceive the page as broken/stuck ("all edges converge to one point and disappear"), especially since the layout engine keeps working on the off-screen portion.
Related but distinct from #29815 (that one was about the Fit to Screen button malfunctioning and was fixed by #30163). Here the initial draw never fit-views at all, on 2.0.3-release.
Environment
- Version: OpenMetadata 2.0.3-release (commit b76076b), UI served from
openmetadata-ui-2.0.3.jar - Deployment: Docker quickstart (docker-compose)
- Browser: Chrome (also reproduced with an embedded WebKit/Chromium view)
- OS: macOS
Steps to reproduce
- Import metadata + lineage so that one entity has many downstream/upstream nodes — e.g. a table
s4_bsis_2024with 1 upstream and 19 downstream tables; after ELK layout the graph spans roughly 1900×3300 px. - Open
http://<host>:8585/lineage/table/<fqn>(or the Lineage tab on the entity page). - Observe the initial viewport once loading finishes.
Current behavior
- The viewport is set by
centerNodePosition(rootNode, instance, zoomValue)— i.e. the root node centered at a fixed zoom (~0.65 default). - With a 3300 px tall graph in a ~900 px tall viewport, everything except the band around the root node is off-screen.
fitViewOptions={{ padding: 48 }}is configured on<ReactFlow>incomponents/Lineage/Lineage.component.tsx, butfitViewis never enabled/invoked on the initial draw, so the option is inert.
Expected behavior
After the initial ELK layout completes, the whole graph should be fitted into the viewport (as the "Fit to screen" control does when invoked manually on a simple graph).
Root cause
In openmetadata-ui/src/main/resources/ui/src/context/LineageProvider/LineageProvider.tsx, redrawLineage() handles the initial draw when called with recenter === true (all initial-load paths do: fetchLineageData, fetchPlatformLineage, and onInitReactFlow). That branch only calls centerNodePosition(...), which uses instance.setCenter(..., { zoom }) — a center-at-fixed-zoom operation that never scales to the graph bounds.
Suggested fix
After the laid-out nodes are committed (setNodes(visibleNodes)), call instance.fitView(...) when recenter === true (keep centerNodePosition for the string/node-focus case):
setNodes(visibleNodes);
setEdges(visibleEdges);
setColumnsHavingLineage(columnsLineageSet);
if (recenter === true) {
// Fit the laid-out graph into the viewport once the new node
// positions are committed to the flow store.
await new Promise((resolve) =>
requestAnimationFrame(() => requestAnimationFrame(resolve))
);
activeReactFlowInstance.fitView({
duration: 400,
maxZoom: Math.max(zoomValue ?? 1, 1),
padding: 0.1,
});
}Verified locally on 2.0.3-release: after rebuilding the UI with this change, the same 24-node/3300px graph loads at scale ≈ 0.167 with all nodes inside the viewport, stable across reloads; the node-focus recentering path is unaffected.
Additional context
- The double
requestAnimationFramewait is needed so the freshly positioned nodes are committed to the react-flow store beforefitViewcomputes bounds. - A stale
zoomValuepersisted inlocalStoragecan mask the symptom in testing — worth clearing when reproducing.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone ✅
Activity