fix(app): handle nullable detail consumers

This commit is contained in:
Gabriel Brown
2026-07-10 17:24:32 -04:00
parent ed21126eea
commit 2beeeb1732
4 changed files with 103 additions and 2 deletions
@@ -1,5 +1,6 @@
'use client';
import type { FunctionReturnType } from 'convex/server';
import type { CSSProperties, PointerEvent as ReactPointerEvent } from 'react';
import { useCallback, useEffect, useState } from 'react';
import { useMutation, useQuery } from 'convex/react';
@@ -59,7 +60,10 @@ type PendingOverwrite = {
};
export const AgentWorkspaceShell = ({ jobId }: { jobId: Id<'agentJobs'> }) => {
const job = useQuery(api.agentJobs.get, { jobId });
const job = useQuery(api.agentJobs.get, { jobId }) as
| FunctionReturnType<typeof api.agentJobs.get>
| null
| undefined;
const messages =
useQuery(api.agentJobs.listMessages, { jobId, limit: 200 }) ?? [];
const events =
@@ -323,6 +327,14 @@ export const AgentWorkspaceShell = ({ jobId }: { jobId: Id<'agentJobs'> }) => {
);
}
if (job === null) {
return (
<main className='text-muted-foreground p-6'>
This workspace was not found.
</main>
);
}
const activeFile = activeFilePath ? files[activeFilePath] : undefined;
const recoverWorkspace = async () => {
if (!job.threadId) return;