Skip to content

Commit 71b9d33

Browse files
committed
fix(ts-client): prevent Overview crash from single-resource cache seeding
updateSingleResource seeded the TanStack cache with { files: [...] } when oldData was null (buffer replay race). This list-shaped fallback broke single-resource queries like libraries.info where the response is a plain object, causing TypeError on statistics.total_capacity. Return undefined instead so the queryFn delivers the correct shape. Batch seeding in updateBatchResources is preserved for file listings.
1 parent 730b177 commit 71b9d33

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

packages/ts-client/src/hooks/useNormalizedQuery.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,9 @@ export function updateSingleResource<O>(
507507

508508
queryClient.setQueryData<O>(queryKey, (oldData: any) => {
509509
if (!oldData) {
510-
return { files: resourcesToUpdate, total_count: resourcesToUpdate.length, has_more: false } as O;
510+
// queryFn will deliver correct data. The { files: [...] } fallback assumes
511+
// list shape, which crashes single-resource queries like libraries.info.
512+
return undefined;
511513
}
512514

513515
// Handle array responses

0 commit comments

Comments
 (0)