Skip to content

Commit 904a044

Browse files
committed
dont drop jobs
1 parent 47b6f0a commit 904a044

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Diff for: js_modules/dagster-ui/packages/ui-core/src/runs/useRunsForTimeline.tsx

+13
Original file line numberDiff line numberDiff line change
@@ -442,10 +442,16 @@ export const useRunsForTimeline = ({
442442
return Object.values(jobsWithCompletedRunsAndOngoingRuns);
443443
}, [jobsWithCompletedRunsAndOngoingRuns]);
444444

445+
const allKeys = useMemo(
446+
() => Object.keys(jobsWithCompletedRunsAndOngoingRuns),
447+
[jobsWithCompletedRunsAndOngoingRuns],
448+
);
449+
445450
const unsortedJobs: TimelineRow[] = useMemo(() => {
446451
if (!workspaceOrError || workspaceOrError.__typename === 'PythonError' || _end < Date.now()) {
447452
return jobsWithCompletedRunsAndOngoingRunsValues;
448453
}
454+
const addedJobKeys = new Set();
449455
const addedAdHocJobs = new Set();
450456
const jobs: TimelineRow[] = [];
451457
for (const locationEntry of workspaceOrError.locationEntries) {
@@ -509,6 +515,7 @@ export const useRunsForTimeline = ({
509515
const runs = [...jobRuns, ...jobTicks];
510516

511517
let row = jobsWithCompletedRunsAndOngoingRuns[jobKey];
518+
addedJobKeys.add(jobKey);
512519
if (row) {
513520
row = {...row, runs};
514521
} else {
@@ -531,6 +538,11 @@ export const useRunsForTimeline = ({
531538
}
532539
}
533540
}
541+
allKeys.forEach((key) => {
542+
if (!addedJobKeys.has(key)) {
543+
jobs.push(jobsWithCompletedRunsAndOngoingRuns[key]!);
544+
}
545+
});
534546
return jobs;
535547
// Don't add start/end time as a dependency here since it changes often.
536548
// Instead rely on the underlying runs changing in response to start/end changing
@@ -540,6 +552,7 @@ export const useRunsForTimeline = ({
540552
jobsWithCompletedRunsAndOngoingRunsValues,
541553
runsByJobKey,
542554
jobsWithCompletedRunsAndOngoingRuns,
555+
allKeys,
543556
]);
544557

545558
const jobsWithRuns = useMemo(() => {

0 commit comments

Comments
 (0)