fix(app): handle nullable detail consumers
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user