fix(workspace): skip queries for missing jobs

This commit is contained in:
Gabriel Brown
2026-07-10 17:24:32 -04:00
parent 2beeeb1732
commit 926008fd3a
2 changed files with 39 additions and 10 deletions
@@ -65,17 +65,27 @@ export const AgentWorkspaceShell = ({ jobId }: { jobId: Id<'agentJobs'> }) => {
| null
| undefined;
const messages =
useQuery(api.agentJobs.listMessages, { jobId, limit: 200 }) ?? [];
useQuery(
api.agentJobs.listMessages,
job ? { jobId, limit: 200 } : 'skip',
) ?? [];
const events =
useQuery(api.agentJobs.listEvents, { jobId, limit: 200 }) ?? [];
useQuery(api.agentJobs.listEvents, job ? { jobId, limit: 200 } : 'skip') ??
[];
const workspaceChanges =
useQuery(api.agentJobs.listWorkspaceChanges, { jobId, limit: 200 }) ?? [];
useQuery(
api.agentJobs.listWorkspaceChanges,
job ? { jobId, limit: 200 } : 'skip',
) ?? [];
const interactions =
useQuery(api.agentJobs.listInteractionRequests, {
jobId,
status: 'all',
}) ?? [];
const uiState = useQuery(api.agentJobs.getWorkspaceUiState, { jobId });
useQuery(
api.agentJobs.listInteractionRequests,
job ? { jobId, status: 'all' } : 'skip',
) ?? [];
const uiState = useQuery(
api.agentJobs.getWorkspaceUiState,
job ? { jobId } : 'skip',
);
const patchUiState = useMutation(api.agentJobs.patchWorkspaceUiState);
const createJobForThread = useMutation(api.agentJobs.createForThread);
const deleteWorkspace = useMutation(api.agentJobs.deleteWorkspace);