Found while fixing #10469 (the react-pages live-data sample read result.records, a key the objectui adapter never emits). Filing rather than fixing: that card is scoped to content/docs/ui/react-pages.mdx only, and this is a different file in a different package.
The defect
packages/client-react/src/data-hooks.tsx carries two TSDoc @example blocks that read data?.value:
:82 — the useQuery example: {data?.value.map(task => (<div key={task.id}>{task.subject}</div>))}:405 — the usePagination example: {data?.value.map(task => <div key={task.id}>{task.subject}</div>)}
Neither hook ever produces a value key.
useQuery declares data as PaginatedResult<T> and assigns it straight from the client (let result: PaginatedResult<T> … setData(result)). PaginatedResult is declared at packages/client/src/index.ts:310 and has exactly four members:
exportinterfacePaginatedResult<T=any>{/** Spec-compliant: array of matching records */records: T[];total?: number;object?: string;hasMore?: boolean;}usePagination inherits the same object — it calls useQuery internally and returns { ...queryResult, page, totalPages, … }, and reads the result itself as queryResult.data?.total.
So data?.value is undefined on every call.
Why this is worse than the sibling defect
The content/docs/ui/react-pages.mdx instance failed silently — the read missed and the list rendered empty. This one throws. ?. short-circuits only when data is nullish; once the query resolves, data is a real object, data.value is undefined, and .map on undefined is a TypeError that takes the component down. A reader copying either example gets a crash on first successful load.
The correct spelling for both is data?.records. The hand-written doc that covers the same hooks already gets it right — content/docs/api/client-sdk.mdx:659 reads data?.records.map(…) — so the two published surfaces for one contract currently disagree, and the wrong one is the one shipped inside the package's own source.
Suggested fix
Change data?.value to data?.records at both sites. Worth checking whether useInfiniteQuery and any other @example in that file read the same key before landing it.
Note on scope
check:doc-formula-expressions does read spec TSDoc @examples, but only for formula expressions, and packages/client-react is not in its surface — nothing currently type-checks these blocks, which is why they rotted unobserved.
Generated by Claude Code
Generated by Claude Code
Found while fixing #10469 (the react-pages live-data sample read
result.records, a key the objectui adapter never emits). Filing rather than fixing: that card is scoped tocontent/docs/ui/react-pages.mdxonly, and this is a different file in a different package.The defect
packages/client-react/src/data-hooks.tsxcarries two TSDoc@exampleblocks that readdata?.value::82— theuseQueryexample:{data?.value.map(task => (<div key={task.id}>{task.subject}</div>))}:405— theusePaginationexample:{data?.value.map(task => <div key={task.id}>{task.subject}</div>)}Neither hook ever produces a
valuekey.useQuerydeclaresdataasPaginatedResult<T>and assigns it straight from the client (let result: PaginatedResult<T>…setData(result)).PaginatedResultis declared atpackages/client/src/index.ts:310and has exactly four members:usePaginationinherits the same object — it callsuseQueryinternally and returns{ ...queryResult, page, totalPages, … }, and reads the result itself asqueryResult.data?.total.So
data?.valueisundefinedon every call.Why this is worse than the sibling defect
The
content/docs/ui/react-pages.mdxinstance failed silently — the read missed and the list rendered empty. This one throws.?.short-circuits only whendatais nullish; once the query resolves,datais a real object,data.valueisundefined, and.maponundefinedis aTypeErrorthat takes the component down. A reader copying either example gets a crash on first successful load.The correct spelling for both is
data?.records. The hand-written doc that covers the same hooks already gets it right —content/docs/api/client-sdk.mdx:659readsdata?.records.map(…)— so the two published surfaces for one contract currently disagree, and the wrong one is the one shipped inside the package's own source.Suggested fix
Change
data?.valuetodata?.recordsat both sites. Worth checking whetheruseInfiniteQueryand any other@examplein that file read the same key before landing it.Note on scope
check:doc-formula-expressionsdoes read spec TSDoc@examples, but only for formula expressions, andpackages/client-reactis not in its surface — nothing currently type-checks these blocks, which is why they rotted unobserved.Generated by Claude Code
Generated by Claude Code