Skip to content

fix(client-react): data-hooks.tsx TSDoc examples read data?.value, not data?.records - #10970

Merged
os-elon merged 1 commit into
mainfrom
claude/issue-10750-data-hooks-tsdoc-records
Aug 22, 2026
Merged

fix(client-react): data-hooks.tsx TSDoc examples read data?.value, not data?.records#10970
os-elon merged 1 commit into
mainfrom
claude/issue-10750-data-hooks-tsdoc-records

Conversation

@os-elon

Copy link
Copy Markdown
Collaborator

Fixes#10750

The defect

packages/client-react/src/data-hooks.tsx carried two TSDoc @example blocks
(the useQuery example at what was line 82, and the usePagination example
at what was line 405) that read data?.value. PaginatedResult never
declared a value key, so the read was always undefined, and once the
query resolved, .map on undefined threw — a reader copying either example
crashed on first successful load.

Where I read the declared type

PaginatedResult<T> is declared at packages/client/src/index.ts:310-319 on
main (verified in this worktree, not taken from the card):

exportinterfacePaginatedResult<T=any>{/** Spec-compliant: array of matching records */records: T[];/** Total number of matching records (if requested) */total?: number;/** The object name */object?: string;/** Whether more records are available */hasMore?: boolean;}

Exactly four members — records, total, object, hasMore — confirming
data?.records (read from the type, not assumed from the card) is the
correct replacement.

The sweep (card's rider)

Searched the file for every @example block rather than trusting the two
cited line numbers:

  • 4 @example blocks examined (lines 68, 243, 386, 497 — useQuery,
    useMutation, usePagination, useInfiniteQuery).
  • 2 carried the bad key — the useQuery example (line 82) and the
    usePagination example (line 405).
  • The useMutation and useInfiniteQuery examples never referenced .value
    at all (useMutation's example logs the mutation result directly;
    useInfiniteQuery's example correctly reads the pre-flattened flatData)
    and needed no change.
  • Confirmed post-fix: grep -n '\.value\b' and grep -rn 'data?.value' over
    packages/client-react/src/ both return nothing.

Verification

  • Premise check: confirmed on origin/main before editing — both sites
    still read data?.value at filing time; the defect was live, not stale.
  • Build (dependency closure):
    pnpm --workspace-concurrency=2 --filter '@objectstack/client-react^...' build
    — 32-package closure, VERDICT command-exit 0.
  • Typecheck: pnpm --filter @objectstack/client-react typecheck
    (tsc --noEmit) — VERDICT command-exit 0.
  • Tests: pnpm --filter @objectstack/client-react test -- --maxWorkers=2
    Test Files 3 passed (3) / Tests 34 passed (34).
  • Reverse verification: does not apply — this is a TSDoc-comment-only
    change with no runtime behavior to revert-and-diff. Ran the package's real
    typecheck and test suite instead (above) as the closest applicable check.
  • Gate union, derived at final commit e8b3bb31f0 via
    node scripts/pm/dispatch-gates.mjs (merge-base 926778bce vs
    origin/main), all run through scripts/pm/os-verify-lock.sh, each its
    own verdict line:
    • pnpm check:changeset-gate-self-tests--- changeset-gate-self-tests EXIT=0 (three self-tests, each printing its own ✓ ... --self-test line)
    • pnpm check:objectui-changeset✓ objectui-changeset-digest --self-test: all checks passed / ✓ objectui-range --self-test: all checks passed
    • pnpm check:slot-lookup✓ slot-lookup ratchet holds: 107 unswept site(s) in 25 file(s), none new
    • pnpm check:test-source-aliascheck-test-source-alias OK — 72 packages with tests scanned
    • pnpm check:type-source-resolutioncheck-type-source-resolution OK — 76 packages with a tsconfig.json scanned
    • node scripts/check-adr-0087-registration.mjs✓ check-adr-0087-registration: this PR adds no declared-breaking changeset
    • node scripts/check-changeset-no-major.mjs✓ This diff introduces no 'major' bump.
    • node scripts/check-ci-filter-parity.mjsOK: all 82 declared cross-package glob(s) ... are covered
    • node scripts/check-empty-changeset.mjs✓ No empty-frontmatter changeset introduced by this diff (1 declaring changeset(s) added).
    • node scripts/check-plugin-teardown-shape.mjs✓ check:plugin-teardown-shape: 57 Plugin implementation(s) ... every teardown-shaped method ... sits beside a real destroy()
    • node scripts/docs-audit/check-affected-docs.mjs✓ affected-docs self-test: 339 cases pass. (then its normal informational route-ledger report)
    • Overall verify-lock verdict for the batch: VERDICT command-exit 0

Changeset

.changeset/data-hooks-tsdoc-records-key.md@objectstack/client-react
patch.

Out of scope

The card's "nothing type-checks these blocks" observation is a separate
devx-lane gate idea, not built here — filed as #10969 (finding +
domain:cli), labels confirmed landed.


Generated by Claude Code

…t data?.records
useQuery and usePagination's @example blocks read data?.value, a key
PaginatedResult never declares (packages/client/src/index.ts:310 declares
exactly records, total, object, hasMore). Unlike the sibling defect in
content/docs/ui/react-pages.mdx (which read?.records failed silently), this
one throws: data resolves to a real object, data.value is undefined, and
.map on undefined is a TypeError that takes the copied component down.
Both sites now read data?.records, matching content/docs/api/client-sdk.mdx.
Swept all four @example blocks in the file per the card's rider: useMutation
and useInfiniteQuery never referenced .value and needed no change.
Fixes#10750
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

Nothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 1 changed package(s)), so this run has no opinion about the docs.

What this run could not see
  • 1 changed file(s) yielded no anchor (packages/client-react/src/data-hooks.tsx) — pages documenting those are invisible to this run

Coarse fallback — 4 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 818e0270037c85b54b4960c98320bf7eba5411b9packageMentionDocs.

@github-actionsgithub-actionsBot added documentation Improvements or additions to documentation tooling labels Aug 22, 2026
@os-elon
os-elon marked this pull request as ready for review August 22, 2026 02:25
@os-elon
os-elon added this pull request to the merge queueAug 22, 2026
Merged via the queue into main with commit 368e7a0Aug 22, 2026
32 checks passed
@os-elon
os-elon deleted the claude/issue-10750-data-hooks-tsdoc-records branch August 22, 2026 02:32
@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 32546214252 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

失败的 job(日志抽取,best effort):

  • Console Pin Gate — 失败步骤: Build the Console SPA at the pinned objectui SHA

    ✗ Build failed in 6.13s
    

↳ 失败原因 是判读的关键:超时Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

跨 PR 相同签名(24h,按失败测试文件聚合):

  • ⚠️本次没有可用的聚合签名(日志里没有能解析出测试文件名的 FAIL 行)—— 这不是「没有同签名的其他 PR」,是这一轮没测到。跨 PR 聚合本次不可用,请手工比对其他 PR 的同类评论。
  • ⚠️ 24h 评论账本没读完(超过 5 页仍未读到窗口尽头),所以上面的「不同 PR 数」是下界,不是全量。

历史信号:

  • 本 PR 过去 24h 无队列失败记录(首次)。
  • 过去 24h 队列共有 64 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationsize/stooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs(client-react): the useQuery and usePagination TSDoc examples read data?.value, which PaginatedResult does not declare — the copied code throws

2 participants

@os-elon@claude