Repository navigation
refactor(lineage): replace LineageProvider with Lineage component + useLineageStore - #33921
Conversation
Adds one-way mirror useEffect blocks so provider-owned graph/data/entity/ filters/ui state is published into useLineageStore while the provider is mounted. Lets consumers migrate to store selectors ahead of the Phase E mount swap, with no change to provider behavior.
This reverts commit cfff808.
Extracts onEdgeClick, onAddPipelineClick, onColumnEdgeRemove — all pure Zustand store reads/writes. Defers onConnect (REST call plus local useMapBasedNodesEdges/entityLineage state, not store-backed) and onEdgeDetailsUpdate (REST call plus local edges/entityLineage state and the local updateEdge closure) to LineageHandlersContext.
This reverts commit a8ea622.
Copy-and-trim LineageProvider.tsx into the new components/Lineage/Lineage orchestrator: props replace useFqn()/URL-derived entity context, the LineageContext wrapper and Task 6 store-mirror effects are removed, and inline overlay JSX (drawer, delete modal, add-pipeline modal, breadcrumbs) is replaced by <LineageOverlays />. A new LineageHandlersContext exposes the 10 handlers that need React-tree access. LineageProvider.tsx is untouched.
…neageControlButtons to store selectors
…rchSelect + LineageTable to store/handlers
LineageProvider.tsx/.interface.tsx/.test.tsx are fully superseded by the Lineage component + useLineageStore/useLineageStore.test.ts. Move LineagePlatformView/LineageTimeRange to hooks/lineage/types.ts and EntityLineageResponse to interface/lineage.interface.ts so the lineage store no longer needs the no-hook-ui-imports eslint suppression for it.
Item 1 (dead reactFlowInstance plumbing in Lineage.tsx) was skipped: the local reactFlowInstance useState is still read at onNodeDrop's reactFlowInstance?.project(...) call, which is wired into the exposed LineageHandlersValue context (onNodeDrop). Deleting the declaration would break that reference, so it was left in place pending a separate, scoped decision on the onNodeDrop/drag-and-drop path.
❌ 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 |
…ider # Conflicts: # openmetadata-ui/src/main/resources/ui/src/components/Entity/EntityLineage/CustomNode.utils.tsx
…refactor-lineage-provider
- Move EdgeDetails/NodeData/LineageData/LineageNodeData/LineagePagingInfo/ CSVExportResponse into interface/lineage.interface (re-exported from their old homes) so rest/lineageAPI no longer imports UI modules. - Import QueryField/QueryFilter and ExploreQuickFilterField types from the interface layer instead of pages/components; drops two store suppressions. - Break the Lineage.interface <-> NodeChildren.interface runtime cycle with type-only imports. - Resolve exhaustive-deps: add stable deps; wrap onNodeDrop, onEntitySelect, selectLoadMoreNode, removeEdgeHandler and removeColumnEdge in useCallback; call narrow-trigger effects (redraw, platform-view refetch, DQ fetch, URL sync, updateEntityData) through latest refs so their firing cadence is unchanged; read selectedQuickFilters via getState in the impact-level effects. - Use the theme-adapting text-utility-brand-600 class for the depth label.
…ider # Conflicts: # .github/playwright/impact-map.generated.json # openmetadata-ui/src/main/resources/ui/src/components/Entity/EntityExportModalProvider/EntityExportModalProvider.interface.ts # openmetadata-ui/src/main/resources/ui/src/components/Entity/EntityLineage/CustomControls.component.tsx # openmetadata-ui/src/main/resources/ui/src/components/Entity/EntityLineage/NodeChildren/NodeChildren.interface.ts # openmetadata-ui/src/main/resources/ui/src/components/Lineage/Lineage.interface.ts # openmetadata-ui/src/main/resources/ui/src/components/Lineage/Lineage/Lineage.tsx # openmetadata-ui/src/main/resources/ui/src/components/Lineage/LineageMap/LineageMap.component.tsx # openmetadata-ui/src/main/resources/ui/src/components/LineageTable/LineageTable.interface.ts # openmetadata-ui/src/main/resources/ui/src/components/LineageTable/LineageTable.tsx # openmetadata-ui/src/main/resources/ui/src/context/LineageProvider/LineageProvider.interface.tsx # openmetadata-ui/src/main/resources/ui/src/context/LineageProvider/LineageProvider.test.tsx # openmetadata-ui/src/main/resources/ui/src/interface/lineage.interface.ts # openmetadata-ui/src/main/resources/ui/src/pages/PlatformLineage/PlatformLineage.tsx # openmetadata-ui/src/main/resources/ui/src/rest/lineageAPI.ts # openmetadata-ui/src/main/resources/ui/src/utils/EntityLineageNodeUtils.ts
🔄 Playwright impact map auto-refreshedThis PR touched specs or UI source that changed the source→spec routing map. I regenerated What is this file? It is the auto-generated half of Playwright's PR planner. It routes "if source X changes, run specs Y" by walking spec imports and cross-referencing What if I want to regenerate locally instead? Run this before pushing your next change to skip the bot commit: python3 .github/scripts/generate_playwright_impact_map.py
git add .github/playwright/impact-map.generated.json
git commit --amend --no-edit # or a separate commit |
The page test mocked the Lineage canvas but not the new <Lineage /> wrapper, so it rendered the real orchestrator and LineageOverlays' breadcrumbs, which call a RouterUtils helper the test's partial mock doesn't provide.
…refactor-lineage-provider
Code Review ✅ Approved 4 closed / 4 findings🟡 Medium risk · Lineage state, edits, filters, and rendering are refactored across UI consumers. Refactors the 2476-line ✅ 4 closed✅ Bug: Quick filters no longer reach Lineage fetch/export queryFilter
✅ Bug: Time filter changes are ignored; URL is no longer read or written
✅ Bug: Edge drawer edits never reach onEdgeDetailsUpdate
✅ Bug: Data-quality lineage kept in local state, never published to store
OptionsDisplay: compact → Counting what did not apply, without listing it. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|



Describe your changes:
LineageProviderwas a 2476-line context provider that bundled seven concerns (data loading, graph state, edit mutations, filters, expand/collapse, selection/drawer, export) into one context value with ~30 memo deps. Because hot arrays (nodes,edges,entityLineage) sat next to stable handlers, every graph mutation re-rendered all 9 consumers.This PR deletes the provider and replaces it with:
useLineageStoreslices (graph, data, entity + ReactFlow, filters, UI) — consumers subscribe via single-field selectors oruseShallow, so each re-renders only on its own slice.<Lineage />orchestrator (components/Lineage/Lineage/Lineage.tsx) — props-driven (entity,entityType,entityFqn,isPlatformLineage), holds the effects/callbacks from the old provider verbatim, mirrors local graph/data/entity state into the store.LineageHandlersContext— a small context with only 10 stable handlers that need React-tree access (ELK relayout, refs, JSX in node data, transactional REST, router).<LineageOverlays />— drawer, delete modal, add-pipeline modal, breadcrumbs; reads modal/drawer state from the store.utils/Lineage/handlers/—onColumnMouseEnter,onPaneClick,onEdgeClick,onAddPipelineClick,onColumnEdgeRemove,exportLineageData.No hook returns JSX; rendering roots are
<Lineage />and<LineageOverlays />only.Type of change:
High-level design:
Approach. Split by concern: state moves to the existing Zustand store; handlers that are genuinely pure move to
utils/Lineage/handlers/; handlers with React-tree dependencies stay in<Lineage />behind a tiny context. Rejected alternatives: prop-drilling (custom nodes are rendered by ReactFlow, so props can't reach them) and pushing imperative handlers into Zustand (they close over router/refs/async state).Why
<Lineage />is still large. Early attempts to extract the data-loader and several handlers into standalone hooks/functions dropped live behavior (ELK relayout, domain-scoped query filter, LOAD_MORE pagination,handleLineageTracing, transactional edge removal,data.labelJSX for new nodes, platform-view fetch branches). Those attempts were reverted and<Lineage />was built by copy-and-trim so effect and callback bodies stay verbatim. The external API is what changed; internal logic is preserved.Consumers migrated:
CustomNode.utils,CanvasEdgeRenderer(hot path, two independent single-field selectors),LineageControlButtons,CustomNodeV1,CustomControls,LineageSearchSelect,LineageTable,LineageMap.Mount points:
EntityLineageTabandPlatformLineagenow render<Lineage />. The pre-existing canvasLineagedefault import is aliased toLineageComponentin both files to avoid a name clash.Type moves:
LineagePlatformView/LineageTimeRange→hooks/lineage/types.ts;EntityLineageResponse→interface/lineage.interface.ts(removes twono-hook-ui-importssuppressions inuseLineageStore).Deleted:
context/LineageProvider/LineageProvider.tsx,.interface.tsx,.test.tsx. No references touseLineageProvider,LineageContext, orcontext/LineageProviderremain.Known carry-overs (intentionally out of scope):
react-hooks/exhaustive-depswarnings inLineage.tsx, copied verbatim from the old provider. Fixing them changes effect cadence, so they need their own audit.no-hook-ui-importssuppression forExploreQuickFilterField. Moving that type touches unrelatedcomponents/Explore/**callers.Tests:
Use cases covered
<Lineage />and push entity context into the storeimpact_analysis→lineagerefetchloadChildNodesHandlerfetches and merges the child subtreeonNodeClickopens the drawer, selects the node, and traces the connected pathupdateEntityDatasyncs entity context to the store synchronouslyUnit tests
hooks/useLineageStore.test.ts— all new slices and actionsutils/Lineage/handlers/{columnInteractions,nodeMutations,edgeMutations,exportHandler}.test.tscomponents/Lineage/LineageOverlays/LineageOverlays.test.tsxcomponents/Lineage/Lineage/Lineage.test.tsx,Lineage.integration.test.tsxuseLineageStore/useLineageHandlersin:CustomNode.utils,CanvasEdgeRenderer,LineageControlButtons,CustomNodeV1,CustomControls,LineageSearchSelect,LineageTable,PlatformLineage,PipelineDetails,ContainerPagetestsBackend integration tests
Ingestion integration tests
Playwright (UI) tests
Manual testing performed
UI screen recording / screenshots:
Pending. No visual change is expected; a smoke recording will be attached before merge.
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.
I have added tests around the new logic.
🤖 Generated with Claude Code
The PR is not safe to merge until lineage edits persist and the migrated graph, filter, time, and data-quality paths share working state.
Findings
Summary
The PR replaces the lineage provider with a store-backed orchestrator, a small handlers context, extracted overlays, and migrated consumers.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart LR Controls[Lineage controls] --> Store[useLineageStore] Store --> Scene[LineageMap scene fetch] Orchestrator[Lineage orchestrator local state] --> Legacy[Lineage fetch and export] Orchestrator --> Mirrors[Graph and entity mirrors] Mirrors --> Store Store --> Overlays[LineageOverlays] Store --> Nodes[CustomNodeV1] Orchestrator --> Handlers[LineageHandlersContext]Reviews (1) · Last reviewed commit: "chore(playwright): auto-refresh impact-m..."