-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Issues/6554 #6577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Issues/6554 #6577
Conversation
The latest updates on your projects. Learn more about Vercel for Git βοΈ
|
Warning Rate limit exceeded@KATT has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 8 minutes and 42 seconds before requesting another review. β How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. π¦ How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. β Files ignored due to path filters (1)
π Files selected for processing (6)
WalkthroughThe changes update the export definitions across multiple Changes
Sequence Diagram(s)sequenceDiagram
participant E as Example (index.ts)
participant QC as QueryClient
participant TR as createTRPCOptionsProxy
E->>QC: Initialize QueryClient instance
E->>TR: Call createTRPCOptionsProxy({ client: null, queryClient: QC })
TR-->>E: Return configured TRPC Options Proxy
Possibly related PRs
Suggested labels
Poem
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? πͺ§ TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
π Deployed to the trpc-pr-6577 environment in trpc-sse-and-websockets
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
π Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
β Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
π Files selected for processing (7)
.github/workflows/release-tmp.yml
(1 hunks)packages/client/package.json
(1 hunks)packages/next/package.json
(1 hunks)packages/react-query/package.json
(1 hunks)packages/server/package.json
(1 hunks)packages/tanstack-react-query/package.json
(1 hunks)scripts/entrypoints.ts
(3 hunks)
β° Context from checks skipped due to timeout of 90000ms (19)
- GitHub Check: E2E-tests (tanstack-start)
- GitHub Check: E2E-tests (standalone-server)
- GitHub Check: E2E-tests (soa)
- GitHub Check: E2E-tests (next-prisma-websockets-starter)
- GitHub Check: E2E-tests (next-prisma-todomvc)
- GitHub Check: E2E-tests (next-prisma-starter)
- GitHub Check: E2E-tests (next-minimal-starter)
- GitHub Check: E2E-tests (next-formdata)
- GitHub Check: E2E-tests (minimal-react)
- GitHub Check: E2E-tests (fastify-server)
- GitHub Check: E2E-tests (express-server)
- GitHub Check: E2E-tests (express-minimal)
- GitHub Check: E2E-tests (cloudflare-workers)
- GitHub Check: E2E-tests (.test/ssg)
- GitHub Check: E2E-tests (.test/internal-types-export)
- GitHub Check: E2E-tests (.test/diagnostics-big-router)
- GitHub Check: E2E-tests (.experimental/next-app-dir)
- GitHub Check: test
- GitHub Check: Lint and auto-fix
π Additional comments (37)
.github/workflows/release-tmp.yml (1)
8-8
: Looks good!
Usingissues/6554
for the release workflow trigger aligns with the PR reference.packages/tanstack-react-query/package.json (1)
27-38
: Export field enhancements are well-structured.
This nested object approach with explicit type references is in line with Nodeβs recommended package exports pattern and improves TypeScript support.scripts/entrypoints.ts (3)
10-24
: New nested export types look good.
Defining explicitimport
,require
, anddefault
objects with separatetypes
fields ensures compatibility with various module resolution strategies and improves type declarations.
56-69
: Top-level export redefinition is consistent.
Providing a well-definedimport
,require
, anddefault
with corresponding.d.ts
,.mjs
, and.js
references clarifies the module entry points.
104-115
: Dynamic exports setup is well-structured.
Assigningimport
,require
, anddefault
with separate type definitions ensures each entrypoint provides proper TypeScript declarations for different module systems.packages/client/package.json (7)
34-45
: Enhance TypeScript type exposure on the main export.
The changes in the main export block now include a"types"
attribute for theimport
,require
, anddefault
keys. This improvement provides better TypeScript support and clarity when users import the package. Please verify that the file paths (i.e."./dist/index.d.ts"
) are valid in your build output.
48-59
: Add TypeScript definitions for the httpBatchLink export.
The export for./links/httpBatchLink
now includes a"types"
entry that points to the appropriate TypeScript file. This change helps consumers get type definitions automatically.
61-73
: Improve type safety for the httpLink export.
Defining a"types"
key in both theimport
andrequire
properties ensures that users get the correct TypeScript definitions when importinghttpLink
.
75-87
: Enhance loggerLink export with explicit type definitions.
The changes correctly add a"types"
property to the loggerLink export. This is beneficial for TypeScript users and maintains consistency with other exports.
89-101
: Include TypeScript definitions in the splitLink export.
The updated structure now provides a"types"
entry alongside the default entry. This contributes to improved type safety and module discoverability.
103-115
: Strengthen WS Link export with type definitions.
The"types"
key added in thewsLink/wsLink
export ensures that TypeScript consumers can enjoy proper type annotations, matching the consistency across all module exports.
117-129
: Explicitly export TypeScript definitions for unstable internals.
Including"types": "./dist/unstable-internals.ts"
in all the export variants ensures consistency and better integration with TypeScript.packages/server/package.json (15)
27-38
: Enhance main export with TypeScript support in the server package.
The main export now includes a"types"
key for each export variant. This addition improves type checking, but please double-check the generatedd.ts
file location.
40-52
: Add TypeScript definitions for the AWS Lambda adapter.
The changes for./adapters/aws-lambda
now expose a"types"
property pointing to the TypeScript definition file, ensuring that serverless adapter users have proper type information.
54-66
: Integrate TypeScript support for the Express adapter.
Providing"types": "./dist/adapters/express.ts"
in all the export variants keeps the export structure consistent and improves usage in TypeScript projects.
68-80
: Improve Fastify adapter export by including types.
The updated export for./adapters/fastify
now contains a"types"
key with a clear path to the TS file, aligning with the broader project goal for better type support.
82-94
: Ensure type definitions for the Fetch adapter are exported.
The change introduces"types": "./dist/adapters/fetch/index.ts"
properly for the fetch adapter. This adjustment is consistent with the new export structure and aids TypeScript integration.
96-108
: Add TypeScript definitions for the Next-app-dir adapter.
The export for./adapters/next-app-dir
now includes the"types"
property, which helps consumers with proper type definition imports.
110-122
: Integrate TypeScript support for the Next adapter export.
The updated"types": "./dist/adapters/next.ts"
along with proper default file paths ensures consistency and enhances developer experience.
124-136
: Expose TypeScript definitions in the Node HTTP adapter.
The inclusion of a"types"
key for the./adapters/node-http
export ensures that users relying on Node HTTP have access to the updated types.
138-150
: Enhance the Standalone adapter export with type definitions.
Adding"types": "./dist/adapters/standalone.ts"
provides clarity and improves type inference for users of the standalone adapter.
152-164
: Strengthen the WS adapter export with precise type definitions.
The new structure for./adapters/ws
now consistently exposes a"types"
property, further standardizing the export layout across adapters.
166-178
: Add TypeScript definitions for the HTTP export.
The./http
export now contains the"types"
key, which is essential for ensuring that all users, regardless of their runtime environment, have clear type paths.
180-192
: Integrate type support in the Observable export.
Exposing"types": "./dist/observable/index.ts"
in the observable export reinforces consistency and type safety in the server package.
194-206
: Include TypeScript definitions for the RPC export.
Ensuring that the RPC export now has a"types"
key helps TypeScript users benefit from accurate type definitions when integrating RPC functionalities.
208-220
: Provide explicit type definitions for the Shared export.
The modifications add a"types"
property for the./shared
export which aids in development by ensuring correct type resolution.
222-234
: Expose TypeScript types for unstable-core-do-not-import.
Including the"types"
key here completes the pattern across all exports and ensures that even experimental modules have accompanying type definitions.packages/react-query/package.json (4)
27-40
: Enhance main export with TypeScript type definitions in the React Query package.
The restructuring of the main export now includes a"types"
key, benefiting consumers by providing direct access to type definitions alongside the module code.
41-54
: Add TypeScript support for the RSC export.
The export for"./rsc"
now includes a"types"
entry pointing to the TypeScript file, which should improve type checking for users of this module.
55-68
: Integrate explicit type definitions in the Server export.
Updating the"./server"
export to include"types": "./dist/server/index.ts"
aligns with the project-wide improvements for TypeScript support and consistency.
69-81
: Provide TypeScript definitions for the Shared export.
By adding a"types"
key for the"./shared"
export, the changes make it easier for developers to get the correct type information when importing shared modules.packages/next/package.json (6)
32-47
: Enhance main export with comprehensive type declarations.
The main export now includes a nested structure with"types"
fields acrossimport
,require
, anddefault
keys. This improvement helps improve module resolution for TypeScript consumers.
48-60
: Add TypeScript definitions for the app-dir client export.
The"./app-dir/client"
export is now updated to include a"types"
key, ensuring that type definitions are properly exposed to users.
62-75
: Integrate type support in the NextCache link export.
For the"./app-dir/links/nextCache"
export, adding"types": "./dist/app-dir/links/nextCache.ts"
ensures that the correct type information is available for end users.
76-89
: Provide TypeScript definitions for the Next HTTP link export.
The update for"./app-dir/links/nextHttp"
now includes the"types"
property, which is consistent with other exports and improves type safety.
90-103
: Add explicit type definitions for the app-dir server export.
The"./app-dir/server"
export now contains a"types"
key, supporting enhanced TypeScript integration for this module.
104-117
: Expose TypeScript types for the SSR prepass export.
Including the"types"
attribute in the"./ssrPrepass"
export ensures that server-side rendering tools receive the necessary type information, keeping the export consistent with the new format.
@@ -76,10 +99,20 @@ export async function generateEntrypoints(rawInputs: string[]) { | |||
// write this entrypoint to the package.json exports field | |||
const esm = './dist/' + pathWithoutSrc.replace(/\.(ts|tsx)$/, '.mjs'); | |||
const cjs = './dist/' + pathWithoutSrc.replace(/\.(ts|tsx)$/, '.js'); | |||
const types = './dist/' + pathWithoutSrc.replace(/\.(ts|tsx)$/, '.ts'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical: Reference the compiled .d.ts
file instead of the source .ts
.
Currently, the script points types
to ./dist/.../file.ts
, which likely does not exist post-compilation. Update it to .d.ts
to reference the compiled type definitions.
Apply this fix:
- const types = './dist/' + pathWithoutSrc.replace(/\.(ts|tsx)$/, '.ts');
+ const types = './dist/' + pathWithoutSrc.replace(/\.(ts|tsx)$/, '.d.ts');
π Committable suggestion
βΌοΈ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
const types = './dist/' + pathWithoutSrc.replace(/\.(ts|tsx)$/, '.ts'); | |
const types = './dist/' + pathWithoutSrc.replace(/\.(ts|tsx)$/, '.d.ts'); |
@trpc/client
@trpc/next
@trpc/server
@trpc/react-query
@trpc/tanstack-react-query
@trpc/upgrade
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
π§Ή Nitpick comments (1)
examples/.test/trpc-tanstack-router-bug-repro/index-workaround.ts (1)
5-5
: Simplify type casting approachThe double type casting (
as unknown as TQueryClient
) is unnecessarily complex and could hide type incompatibilities.Consider simplifying to:
- const queryClient = (new QueryClient()) as unknown as TQueryClient; + const queryClient = new QueryClient() as TQueryClient;
π Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
β Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
π Files selected for processing (4)
examples/.test/trpc-tanstack-router-bug-repro/index-workaround.ts
(1 hunks)examples/.test/trpc-tanstack-router-bug-repro/index.ts
(1 hunks)examples/.test/trpc-tanstack-router-bug-repro/package.json
(1 hunks)examples/.test/trpc-tanstack-router-bug-repro/tsconfig.json
(1 hunks)
β Files skipped from review due to trivial changes (2)
- examples/.test/trpc-tanstack-router-bug-repro/tsconfig.json
- examples/.test/trpc-tanstack-router-bug-repro/package.json
π§° Additional context used
πͺ Biome (1.9.4)
examples/.test/trpc-tanstack-router-bug-repro/index-workaround.ts
[error] 2-2: Import attributes cannot be used with a type-only import.
The type-only import is defined here.
(syntax/correctness/noTypeOnlyImportAttributes)
β° Context from checks skipped due to timeout of 90000ms (20)
- GitHub Check: E2E-tests (fastify-server)
- GitHub Check: e2e-legacy-node (next-prisma-todomvc, 20.x)
- GitHub Check: E2E-tests (express-server)
- GitHub Check: e2e-legacy-node (next-prisma-todomvc, 18.x)
- GitHub Check: E2E-tests (express-minimal)
- GitHub Check: Release using pkg.pr.new
- GitHub Check: e2e-legacy-node (next-prisma-websockets-starter, 20.x)
- GitHub Check: E2E-tests (cloudflare-workers)
- GitHub Check: e2e-legacy-node (next-prisma-websockets-starter, 18.x)
- GitHub Check: E2E-tests (.test/ssg)
- GitHub Check: e2e-legacy-node (next-prisma-starter, 20.x)
- GitHub Check: E2E-tests (.test/internal-types-export)
- GitHub Check: Test a monorepo using built declaration files
- GitHub Check: e2e-legacy-node (next-prisma-starter, 18.x)
- GitHub Check: E2E-tests (.test/diagnostics-big-router)
- GitHub Check: E2E-tests (Bun) (bun, ubuntu-latest)
- GitHub Check: E2E-tests (.experimental/next-app-dir)
- GitHub Check: E2E-tests (Deno) (deno-deploy)
- GitHub Check: test
- GitHub Check: Lint and auto-fix
π Additional comments (3)
examples/.test/trpc-tanstack-router-bug-repro/index-workaround.ts (1)
7-10
: Avoid usingnull as any
for client propertyUsing
null as any
bypasses TypeScript's type checking and can lead to runtime errors.If this is a workaround for a specific issue (as the filename suggests), consider adding a comment explaining why this approach is necessary. If possible, provide a more type-safe alternative.
examples/.test/trpc-tanstack-router-bug-repro/index.ts (2)
1-9
: Code duplication with index-workaround.tsThis file implements nearly identical functionality to
index-workaround.ts
. Consider documenting the purpose of having two similar files or consolidating them.Are both files needed for demonstrating different aspects of the bug? If so, adding comments explaining the differences would improve clarity.
7-7
: Avoid usingnull as any
for client propertyUsing
null as any
bypasses TypeScript's type checking and can lead to runtime errors.If this is intentional for a bug reproduction, consider adding a comment explaining the issue being demonstrated. For example:
// Using null client to reproduce issue #6554 with TRPC and TanStack Router integration client: null as any,
import {QueryClient} from "@tanstack/react-query"; | ||
import type {QueryClient as TQueryClient} from "@tanstack/react-query" with {'resolution-mode': 'require'}; | ||
import {createTRPCOptionsProxy} from "@trpc/tanstack-react-query"; | ||
|
||
const queryClient = (new QueryClient()) as unknown as TQueryClient; | ||
|
||
const trpc = createTRPCOptionsProxy({ | ||
client: null as any, | ||
queryClient, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix TypeScript import attribute usage
The import attribute {'resolution-mode': 'require'}
cannot be used with a type-only import on line 2. This is causing a Biome error.
Apply this fix:
- import type {QueryClient as TQueryClient} from "@tanstack/react-query" with {'resolution-mode': 'require'};
+ import type {QueryClient as TQueryClient} from "@tanstack/react-query";
π Committable suggestion
βΌοΈ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
import {QueryClient} from "@tanstack/react-query"; | |
import type {QueryClient as TQueryClient} from "@tanstack/react-query" with {'resolution-mode': 'require'}; | |
import {createTRPCOptionsProxy} from "@trpc/tanstack-react-query"; | |
const queryClient = (new QueryClient()) as unknown as TQueryClient; | |
const trpc = createTRPCOptionsProxy({ | |
client: null as any, | |
queryClient, | |
}); | |
import {QueryClient} from "@tanstack/react-query"; | |
import type {QueryClient as TQueryClient} from "@tanstack/react-query"; | |
import {createTRPCOptionsProxy} from "@trpc/tanstack-react-query"; | |
const queryClient = (new QueryClient()) as unknown as TQueryClient; | |
const trpc = createTRPCOptionsProxy({ | |
client: null as any, | |
queryClient, | |
}); |
π§° Tools
πͺ Biome (1.9.4)
[error] 2-2: Import attributes cannot be used with a type-only import.
The type-only import is defined here.
(syntax/correctness/noTypeOnlyImportAttributes)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
π§Ή Nitpick comments (1)
.github/workflows/main.yml (1)
79-79
: YAML Indentation Issue in New Test Directory Entry
The new directory entry.test/trpc-tanstack-router-bug-repro
is indented with 12 spaces, yet the YAML linter expects an indentation of 10 spaces on this line. Please adjust the indentation to conform with the expected format and resolve the linting warning.π§° Tools
πͺ YAMLlint (1.35.1)
[warning] 79-79: wrong indentation: expected 10 but found 12
(indentation)
π Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
β Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
π Files selected for processing (3)
.github/workflows/main.yml
(1 hunks).vscode/settings.json
(1 hunks)examples/.test/trpc-tanstack-router-bug-repro/package.json
(1 hunks)
π§ Files skipped from review as they are similar to previous changes (1)
- examples/.test/trpc-tanstack-router-bug-repro/package.json
π§° Additional context used
πͺ YAMLlint (1.35.1)
.github/workflows/main.yml
[warning] 79-79: wrong indentation: expected 10 but found 12
(indentation)
β° Context from checks skipped due to timeout of 90000ms (19)
- GitHub Check: E2E-tests (express-server)
- GitHub Check: E2E-tests (express-minimal)
- GitHub Check: E2E-tests (cloudflare-workers)
- GitHub Check: e2e-legacy-node (next-prisma-todomvc, 20.x)
- GitHub Check: E2E-tests (.test/ssg)
- GitHub Check: e2e-legacy-node (next-prisma-todomvc, 18.x)
- GitHub Check: E2E-tests (.test/trpc-tanstack-router-bug-repro)
- GitHub Check: e2e-legacy-node (next-prisma-websockets-starter, 20.x)
- GitHub Check: E2E-tests (.test/internal-types-export)
- GitHub Check: E2E-tests (.test/diagnostics-big-router)
- GitHub Check: Release using pkg.pr.new
- GitHub Check: e2e-legacy-node (next-prisma-websockets-starter, 18.x)
- GitHub Check: Test a monorepo using built declaration files
- GitHub Check: E2E-tests (.experimental/next-app-dir)
- GitHub Check: e2e-legacy-node (next-prisma-starter, 20.x)
- GitHub Check: e2e-legacy-node (next-prisma-starter, 18.x)
- GitHub Check: E2E-tests (Bun) (bun, ubuntu-latest)
- GitHub Check: E2E-tests (Deno) (deno-deploy)
- GitHub Check: test
π Additional comments (1)
.vscode/settings.json (1)
32-32
: Verify Explorer Exclusion Setting Change
The setting"explorer.excludeGitIgnore": false
will now make files and directories normally ignored by Git visible in the VSCode explorer. Please confirm that this change is intentional, as it may lead to increased clutter in the file explorer view.
# Conflicts: # pnpm-lock.yaml
Closes #6554
π― Changes
β Checklist
Summary by CodeRabbit
Summary by CodeRabbit
Refactor
New Features
package.json
andtsconfig.json
for the TRPC integration example project, specifying dependencies and compiler options.Chores