Repository navigation
docs(client): document the public API with JSDoc and docs links - #7814
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes.
|
| Layer / File(s) | Summary |
|---|---|
Client APIs and call options packages/client/src/TRPCClientError.ts, packages/client/src/createTRPCClient.ts, packages/client/src/createTRPCUntypedClient.ts, packages/client/src/getFetch.ts, packages/client/src/internals/TRPCUntypedClient.ts, packages/client/src/internals/types.ts, packages/client/src/safe.ts |
Comments describe client errors, client creation, typed and untyped calls, request options, and safe error handling. |
Link contracts and local links packages/client/src/links/types.ts, packages/client/src/links/splitLink.ts, packages/client/src/links/localLink.ts, packages/client/src/links/loggerLink.ts, packages/client/src/links/retryLink.ts |
Comments describe operation and link types, link routing, local calls, logging, and retries. |
HTTP link options and behavior packages/client/src/links/HTTPBatchLinkOptions.ts, packages/client/src/links/httpBatchLink.ts, packages/client/src/links/httpBatchStreamLink.ts, packages/client/src/links/httpLink.ts, packages/client/src/links/httpSubscriptionLink.ts, packages/client/src/links/internals/contentTypes.ts, packages/client/src/links/internals/httpUtils.ts |
Comments describe HTTP link options and documented request, batching, streaming, subscription, and input behavior. |
WebSocket client and link packages/client/src/links/internals/urlWithConnectionParams.ts, packages/client/src/links/wsLink/createWsClient.ts, packages/client/src/links/wsLink/wsClient/encoder.ts, packages/client/src/links/wsLink/wsClient/options.ts, packages/client/src/links/wsLink/wsClient/wsClient.ts, packages/client/src/links/wsLink/wsLink.ts |
Comments describe WebSocket client options, message encoding, connection state, and the WebSocket link. |
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Other
Possibly related PRs
- trpc/trpc#7191: Documents the server
maxBatchSizecontract referenced by the client batch-size documentation. - trpc/trpc#7809: Adds the documentation-link checker used for source links in this pull request.
- trpc/trpc#7815: Applies related public API documentation and link updates to
@trpc/tanstack-react-query.
Suggested reviewers: nick-lucas
Merge Risk: 
Low · previous review fcd1b
-
The outstanding API descriptions may mislead users about errors, cancellation, batching, subscriptions, and logging. These bounded documentation risks warrant owner awareness but do not establish a merge-blocking failure.
Pre-merge checks: 
5
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 7 functions across 25 files.
-
Finishing Touches
-
Generate docstrings
-
- Commit to this branch
- Create a new PR
Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
|
@coderabbitai review |
@trpc/client
@trpc/next
@trpc/openapi
@trpc/react-query
@trpc/server
@trpc/tanstack-react-query
@trpc/upgrade
commit: |
|
@coderabbitai review |
Action performed
|
|
@coderabbitai review |
Action performed
|
8813c0d to
fcd1b78
Compare
fcd1b78 to
7befde9
Compare
trpc-bot
left a comment
There was a problem hiding this comment.
CI is green and CodeRabbit has no open findings at this head.
Co-authored-by: alexander <[email protected]>
Co-authored-by: alexander <[email protected]>
7befde9 to
c450006
Compare
…sources (trpc#7809) <!-- CURSOR_AGENT_PR_BODY_BEGIN --> ## Why - The missing-transformer type error said "on your your `initTRPC`-object". - Many `trpc.io/docs` links in `packages/*/src` used old paths (`/docs/v11/...`, `http://`, moved Next.js pages). Nothing caught them. ## What - Fix the message to match the docs quote: ``You must define a transformer on your `initTRPC`-object first``. A type test in `packages/tests/server/transformer.test.ts` asserts the exact text. - Point every existing docs link in package sources at its current v11 page (16 files). - Add `www/build/package-links.test.ts`. It runs in CI through `pnpm --filter www test`. It fails when a `trpc.io/docs` link in `packages/*/src`: - isn't the canonical `https://trpc.io/docs/...` form, - isn't a v11 docs page (slugs come from the site's own `docPages()`), or - has an `#anchor` that isn't a heading on that page (ids come from the site's own `anchorsOf()`, so `{#id}` overrides count). This is the base of a stack. The JSDoc work is split into one PR per package, each based on this branch: - trpc#7810 `@trpc/server` - trpc#7814 `@trpc/client` - trpc#7813 `@trpc/react-query` (deprecated: bug fixes only, removed in the next major) - trpc#7815 `@trpc/tanstack-react-query` - trpc#7812 `@trpc/next` (deprecated in favor of `@trpc/tanstack-react-query`) - trpc#7811 `@trpc/openapi` and `@trpc/upgrade` ## Links None. No docs pages change. ## Alternatives considered - A script in `scripts/`: it would have to copy the site's slug and heading-id rules. The www test reuses them, so it matches the built routes. ## Testing - `pnpm test -- --watch false`, `pnpm --filter www test`, `pnpm typecheck-packages`, `pnpm lint`, `pnpm format`, `pnpm build && pnpm verify-packed` all pass. - I checked that the link test fails on a bad page and on a bad anchor. <!-- CURSOR_AGENT_PR_BODY_END --> <div><a href="https://cursor.com/agents/bc-582c9e70-feeb-562d-989d-e010a7eed5a5?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a> <a href="https://cursor.com/background-agent?bcId=bc-582c9e70-feeb-562d-989d-e010a7eed5a5&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a> </div> <!-- codesmith:footer --> --- <a href="https://app.blacksmith.sh/trpc/codesmith/trpc/pr/7809?autoLogin=true&ref=codesmith_pr_footer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v3.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-light-v3.svg"><img alt="View with [code]smith" src="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v3-3x.png" width="162" height="28"></picture></a> <a href="https://backend.blacksmith.sh/track/enable-autofix?expires=1796215022&installation_model_id=443568&pr_number=7809&ref=codesmith_pr_footer&repository=trpc%2Ftrpc&return_to=https%3A%2F%2Fgithub.com%2Ftrpc%2Ftrpc%2Fpull%2F7809&signature=d5f54bfe70dbaca02e62f8e232c205f9e96577f47476b138ea711f417dad2882"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-light.svg"><img alt="Autofix with [code]smith" src="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png" width="190" height="28"></picture></a> <sup>Need help on this PR? Tag <code>@codesmith-bot</code> with what you need.</sup> <!-- codesmith:autofix:disabled --> <!-- /codesmith:footer --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit - **Documentation** - Updated links across client, React, Next.js, TanStack Query, and server references to current documentation paths and secure HTTPS URLs. - Corrected a typo in a transformer-related error message. - **Tests** - Added checks for documentation link formats and heading references, and expanded transformer type coverage. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Cursor Agent <[email protected]>
|
This pull request has been locked because we are very unlikely to see comments on closed issues. If you think, this PR is still necessary, create a new one with the same branch. Thank you. |
Why
Many public
@trpc/clientAPIs had no summary, or no link to their docs page.What
createTRPCClient,TRPCClient,TRPCClientError,safe, the link types and every built-in link and its options, with@see https://trpc.io/docs/...to the exact page and heading.@deprecatednames the replacement:inferRouterClientandCreateTRPCClient(useTRPCClient),unstable_httpBatchStreamLink,unstable_httpSubscriptionLink,experimental_localLink.This is stacked on #7809, which adds the link check. It's one of one-PR-per-package.
APIs with no docs page (not invented):
createTRPCUntypedClient,TRPCUntypedClient,getUntypedClient,getFetch.Links
None. No docs pages change.
Alternatives considered
None.
Testing
www/build/package-links.test.tschecks every new link against the v11 pages and headings.pnpm test -- --watch false,pnpm typecheck-packages,pnpm lint,pnpm format,pnpm build && pnpm verify-packedpass.Need help on this PR? Tag
@codesmith-botwith what you need.Summary by CodeRabbit