Skip to content

Commit f72a237

Browse files
authored
Fix: Re-fetch model's lineage after change to models/columns in file (#891)
1 parent 93b56e9 commit f72a237

File tree

6 files changed

+49
-45
lines changed

6 files changed

+49
-45
lines changed

web/client/src/library/components/graph/Graph.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,8 @@ function ModelColumnLineage({
679679
onNodesChange={onNodesChange}
680680
onEdgesChange={onEdgesChange}
681681
nodeOrigin={[0.5, 0.5]}
682+
minZoom={0.1}
683+
maxZoom={1.5}
682684
fitView
683685
>
684686
<Controls className="bg-light p-1 rounded-md !border-none !shadow-lg" />

web/client/src/library/components/graph/ModelLineage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ export default function ModelLineage({
1717
highlightedNodes?: Record<string, string[]>
1818
className?: string
1919
}): JSX.Element {
20-
const { clearActiveEdges, setLineage } = useLineageFlow()
20+
const { clearActiveEdges, setLineage, models } = useLineageFlow()
2121

2222
const { data: dataLineage, refetch: getModelLineage } = useApiModelLineage(
2323
model.name,
2424
)
2525

2626
const debouncedGetModelLineage = useCallback(
2727
debounceAsync(getModelLineage, 500),
28-
[model.name],
28+
[model.name, models],
2929
)
3030

3131
useEffect(() => {

web/client/src/library/components/graph/help.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,14 @@ function getNodeMap({
177177
const CHAR_WIDTH = 8
178178
const MAX_VISIBLE_COLUMNS = 5
179179

180-
const current = nodes.reduce(
181-
(acc: Record<string, Node>, node) =>
182-
Object.assign(acc, { [node.id]: node }),
183-
{},
184-
)
180+
const current = nodes.reduce((acc: Record<string, Node>, node) => {
181+
// Checking if any nodes have been removed from the graph
182+
if (models.has(node.id)) {
183+
acc[node.id] = node
184+
}
185+
186+
return acc
187+
}, {})
185188

186189
return modelNames.reduce((acc: Record<string, Node>, label: string) => {
187190
const node =

web/client/src/library/pages/ide/IDE.tsx

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ import { EnumSize, EnumVariant } from '~/types/enum'
1515
import { Link, Outlet, useLocation, useNavigate } from 'react-router-dom'
1616
import { EnumRoutes } from '~/routes'
1717
import { useStoreFileTree } from '@context/fileTree'
18-
import { Divider } from '@components/divider/Divider'
18+
import IDEProvider, { EnumErrorKey, useIDE } from './context'
19+
import { type Model } from '@api/client'
1920
import { Button } from '@components/button/Button'
21+
import { Divider } from '@components/divider/Divider'
2022
import Container from '@components/container/Container'
21-
import { EnumErrorKey, useIDE } from './context'
22-
import { type Model } from '@api/client'
2323

2424
const ReportErrors = lazy(
2525
async () => await import('../../components/report/ReportErrors'),
@@ -114,35 +114,39 @@ export default function PageIDE(): JSX.Element {
114114

115115
return (
116116
<Container.Page>
117-
<PlanSidebar />
118-
<div className="w-full flex justify-between items-center min-h-[2rem] z-50">
119-
<div className="px-3 flex items-center whitespace-nowrap">
120-
<h3 className="font-bold text-primary-500">
121-
<span className="inline-block">/</span>
122-
{project?.name}
123-
</h3>
124-
<ArrowLongRightIcon className="w-8 mx-4 text-neutral-50" />
125-
<Button
126-
size={EnumSize.sm}
127-
variant={EnumVariant.Neutral}
128-
>
129-
{isActivePageEditor ? (
130-
<Link to={EnumRoutes.IdeDocs}>Docs</Link>
131-
) : (
132-
<Link to={EnumRoutes.IdeEditor}>Editor</Link>
133-
)}
134-
</Button>
135-
</div>
136-
<div className="px-3 flex items-center min-w-[10rem] justify-end">
137-
<RunPlan />
138-
<Suspense>
139-
{activePlan != null && <ActivePlan plan={activePlan} />}
140-
</Suspense>
141-
<ReportErrors />
117+
<IDEProvider>
118+
<PlanSidebar />
119+
<div className="w-full flex justify-between items-center min-h-[2rem] z-50">
120+
<div className="px-3 flex items-center whitespace-nowrap">
121+
<h3 className="font-bold text-primary-500">
122+
<span className="inline-block">/</span>
123+
{project?.name}
124+
</h3>
125+
<ArrowLongRightIcon className="w-8 mx-4 text-neutral-50" />
126+
<Button
127+
size={EnumSize.sm}
128+
variant={EnumVariant.Neutral}
129+
>
130+
{isActivePageEditor ? (
131+
<Link to={EnumRoutes.IdeDocs}>Docs</Link>
132+
) : (
133+
<Link to={EnumRoutes.IdeEditor}>Editor</Link>
134+
)}
135+
</Button>
136+
</div>
137+
{isActivePageEditor && (
138+
<div className="px-3 flex items-center min-w-[10rem] justify-end">
139+
<RunPlan />
140+
<Suspense>
141+
{activePlan != null && <ActivePlan plan={activePlan} />}
142+
</Suspense>
143+
<ReportErrors />
144+
</div>
145+
)}
142146
</div>
143-
</div>
144-
<Divider />
145-
<Outlet />
147+
<Divider />
148+
<Outlet />
149+
</IDEProvider>
146150
</Container.Page>
147151
)
148152
}

web/client/src/routes.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { createBrowserRouter } from 'react-router-dom'
2-
import IDEProvider from './library/pages/ide/context'
32
import { Suspense, lazy } from 'react'
43
import NotFound from './library/pages/root/NotFound'
54
import Loading from '@components/loading/Loading'
@@ -25,11 +24,7 @@ export const EnumRoutes = {
2524
export const router = createBrowserRouter([
2625
{
2726
path: '/',
28-
element: (
29-
<IDEProvider>
30-
<IDE />
31-
</IDEProvider>
32-
),
27+
element: <IDE />,
3328
children: [
3429
{
3530
path: 'editor',

web/server/api/endpoints/plan.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ async def run_plan(
7272
if interval.snapshot_name in plan.context_diff.snapshots
7373
else interval.snapshot_name,
7474
interval=[
75-
tuple([to_ds(t) for t in make_inclusive(start, end)])
75+
tuple(to_ds(t) for t in make_inclusive(start, end))
7676
for start, end in interval.merged_intervals
7777
][0],
7878
batches=tasks.get(interval.snapshot_name, 0),

0 commit comments

Comments
 (0)