Skip to content

Conversation

@KATT
Copy link
Member

@KATT KATT commented Feb 11, 2025

🎯 Changes

Remove intersection checks for the client proxy - we don't expose anything but the procedures themselves when we decorate it

✅ Checklist

  • I have followed the steps listed in the Contributing guide.
  • If necessary, I have added documentation related to the changes made.
  • I have added or updated the tests related to the changes made.

Summary by CodeRabbit

  • Refactor
    • Streamlined client type definitions by replacing deprecated types with a unified client type for improved consistency and type safety.
  • Tests
    • Updated and added regression tests to validate enhanced client behavior and ensure responses meet expectations.
  • Chores
    • Upgraded the build configuration with bundle size analysis to support continuous integration and provide better module monitoring.

@KATT KATT requested a review from a team as a code owner February 11, 2025 15:34
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 11, 2025

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This pull request refactors the TRPC client types and updates function signatures across multiple packages. Deprecated types such as IntersectionError and the alias CreateTRPCClient are removed, replaced by a consistent use of TRPCClient and a new type InferrableClientTypes. Test cases and proxy callbacks are updated accordingly, and the rollup configuration for the react-query package now performs size analysis and logging. Minor restructuring in examples and server-side helpers further aligns the entire codebase with the new type inference approach.

Changes

File(s) Change Summary
packages/client/src/createTRPCClient.ts, packages/client/src/internals/TRPCUntypedClient.ts, packages/next/src/app-dir/shared.ts, packages/next/src/withTRPC.tsx, packages/react-query/src/utils/createUtilityFunctions.ts, packages/react-query/src/internals/context.tsx, packages/react-query/src/server/ssgProxy.ts, packages/react-query/src/shared/hooks/types.ts, packages/react-query/src/shared/proxy/useQueriesProxy.ts, packages/tanstack-react-query/src/internals/createOptionsProxy.ts, packages/tanstack-react-query/src/internals/Context.tsx, packages/next/src/app-dir/client.ts Updated type definitions to replace CreateTRPCClient and inferRouterClient with TRPCClient, introduced InferrableClientTypes, and modified function signatures accordingly.
packages/server/src/unstable-core-do-not-import/createProxy.ts, packages/server/src/unstable-core-do-not-import/clientish/inferrable.ts Adjusted proxy callback parameter type and refined type inference behavior by introducing a new helper type PickTypes.
packages/tests/server/regression/issue-3710-client.test.ts, packages/tests/server/react/regression/issue-3461-reserved-properties.test.tsx, packages/tests/server/getUntypedClient.test.ts Updated tests: added a new case for using a client as a procedure name, removed a vanilla client test, and streamlined test setup by using routerToServerAndClientNew and enhanced type inference.
packages/express-minimal/src/router.ts Simplified router structure by inlining helloRouter into appRouter while preserving greeting procedure functionality.
packages/react-query/rollup.config-1739405461180.mjs Introduced a comprehensive Rollup build configuration with plugins for TypeScript support, module resolution, size analysis, and logging utilities.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant CC as createTRPCClient
    participant Proxy as createTRPCClientProxy
    participant Client as TRPCClient Instance
    Dev->>CC: Call createTRPCClient(opts)
    CC->>Proxy: Wrap untyped client
    Proxy->>Client: Instantiate TRPCClient using opts
    Client-->>Proxy: Return TRPCClient instance
    Proxy-->>CC: Forward TRPCClient instance
    CC-->>Dev: Return TRPCClient instance
Loading
sequenceDiagram
    participant Caller
    participant FlatP as createFlatProxy
    Caller->>FlatP: Access property (key)
    FlatP->>FlatP: Process key (skip 'then')
    FlatP-->>Caller: Return property value via callback
Loading

Possibly related PRs

Suggested labels

♻️ autoupdate

Poem

Oh, I'm a rabbit, light and fleet, 🐇
Dancing 'round the code so neat.
Types streamlined with every hop,
Old errors and tests now drop.
In TRPC’s fields, our changes bloom,
A code garden to lift the gloom.
Happy leaps in every room!


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@vercel
Copy link

vercel bot commented Feb 11, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
next-prisma-starter ✅ Ready (Inspect) Visit Preview Feb 19, 2025 9:41am
og-image ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 19, 2025 9:41am
www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 19, 2025 9:41am

@railway-app
Copy link

railway-app bot commented Feb 11, 2025

🚅 Previously deployed to Railway in the trpc-sse-and-websockets project. Environment has been deleted.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 11, 2025

Open in Stackblitz

@trpc/client

npm i https://pkg.pr.new/trpc/trpc/@trpc/client@6484

@trpc/next

npm i https://pkg.pr.new/trpc/trpc/@trpc/next@6484

@trpc/server

npm i https://pkg.pr.new/trpc/trpc/@trpc/server@6484

@trpc/react-query

npm i https://pkg.pr.new/trpc/trpc/@trpc/react-query@6484

@trpc/tanstack-react-query

npm i https://pkg.pr.new/trpc/trpc/@trpc/tanstack-react-query@6484

@trpc/upgrade

npm i https://pkg.pr.new/trpc/trpc/@trpc/upgrade@6484

commit: e8172e3

@KATT KATT merged commit 394b0f5 into next Feb 19, 2025
44 checks passed
@KATT KATT deleted the discussions/6477-fix branch February 19, 2025 09:51
@github-actions
Copy link
Contributor

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DX: using client as the route name causes an error

4 participants