Skip to content
Open
4 changes: 4 additions & 0 deletions packages/core/src/canvas/dashboardSchemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ export const dashboardSummarySchema = z.object({
// The React source, included so the grid can render a live preview without an
// N+1 of get()s (it rides in the FS row's meta, already loaded when listing).
code: z.string().optional(),
// Id of the task currently generating this canvas (see dashboardRecordSchema).
// Surfaced on the summary so the sidebar can show the run nested under the
// canvas without a per-canvas get().
generationTaskId: z.string().nullish(),
});
export type DashboardSummary = z.infer<typeof dashboardSummarySchema>;

Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/canvas/dashboardsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export class DashboardsService {
createdBy,
updatedAt,
code,
generationTaskId,
}) => ({
id,
channelId: cid,
Expand All @@ -98,6 +99,7 @@ export class DashboardsService {
createdBy,
updatedAt,
code,
generationTaskId,
}),
);
}
Expand Down
7 changes: 5 additions & 2 deletions packages/core/src/sidebar/buildSidebarData.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { TaskRunStatus } from "@posthog/shared/domain-types";
import type { Task, TaskRunStatus } from "@posthog/shared/domain-types";
import { getRepositoryInfo } from "./groupTasks";
import type { TaskData } from "./sidebarData.types";

Expand Down Expand Up @@ -35,7 +35,10 @@ export interface SidebarTask {
} | null;
}

export function narrowFullTask(task: FullTask): SidebarTask {
// Accepts both the local `FullTask` shape and the canonical `Task` from
// `@posthog/shared` so callers holding a real `Task` can narrow it directly,
// without an `as unknown as FullTask` escape hatch.
export function narrowFullTask(task: FullTask | Task): SidebarTask {
const slackThreadUrl = task.latest_run?.state?.slack_thread_url;
return {
id: task.id,
Expand Down
Loading
Loading