Skip to content

Conversation

@KATT
Copy link
Member

@KATT KATT commented Mar 19, 2025

Closes #

🎯 Changes

  • Remove unstable from streaming links
  • Remove unstable from lazy

Summary by CodeRabbit

  • Refactor

    • Transitioned from experimental to stable mechanisms for data fetching, real-time subscriptions, and batch processing, enhancing overall reliability and performance.
    • Updated dynamic routing with standardized lazy loading for smoother module activation.
  • New Features

    • Introduced configurable options for optimizing batch requests, including maxURLLength and maxItems.
  • Documentation

    • Revised technical guides and examples to reflect the new stable implementations and batch configuration options, including updates to the httpBatchStreamLink and httpSubscriptionLink.
  • Tests

    • Updated test setups to validate the new stable configurations and ensure consistent system behavior.

@KATT KATT requested review from a team as code owners March 19, 2025 11:02
@vercel
Copy link

vercel bot commented Mar 19, 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 Mar 21, 2025 10:30am
og-image ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 21, 2025 10:30am
www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 21, 2025 10:30am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 19, 2025

Warning

Rate limit exceeded

@KATT has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 3 minutes and 43 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

📥 Commits

Reviewing files that changed from the base of the PR and between 30c7728 and 818bb36.

📒 Files selected for processing (4)
  • packages/tanstack-react-query/test/useSubscription.test.tsx (2 hunks)
  • packages/tests/server/adapters/fastify.test.ts (2 hunks)
  • packages/tests/server/httpSubscriptionLink.headers.retryLink.test.ts (3 hunks)
  • packages/tests/server/streaming.test.ts (3 hunks)

Walkthrough

This pull request primarily replaces unstable TRPC link implementations with their stable counterparts across examples, tests, and documentation. Several files now import and use httpBatchStreamLink and httpSubscriptionLink instead of their unstable versions. Additionally, the experimental lazy-loading API has been renamed to a stable lazy function, with corresponding documentation updates. In the client link package, a new optional property (maxItems) is introduced and integrated into the batch link’s validation logic. Overall, the changes standardize and stabilize API usage while maintaining existing functionality.

Changes

File(s) Change Summary
examples/{.experimental/next-app-dir, minimal, next-minimal-starter, next-prisma-starter, next-sse-chat, tanstack-start}/… Updated TRPC client imports: replaced unstable_httpBatchStreamLink/unstable_httpSubscriptionLink with stable versions and adjusted lazy-loading usage.
packages/{client/src/__tests__/…, react-query/test/…} Updated test files to replace unstable link imports with httpBatchStreamLink and httpSubscriptionLink, preserving the original logic.
packages/client/src/links/{HTTPBatchLinkOptions.ts, httpBatchLink.ts, httpBatchStreamLink.ts, httpSubscriptionLink.ts} Added new optional property maxItems (with JSDoc) to HTTPBatchLinkOptions; introduced a variable for maxItems in validation; renamed unstable links to their stable equivalents and simplified option types.
packages/server/src/@trpc/server/index.ts, packages/server/src/unstable-core-do-not-import/router.ts Exported a new stable lazy function; deprecated experimental_lazy with an alias; updated error messages to reference lazy correctly.
packages/tests/server/{adapters, regression, streaming, …} Across various test files, replaced unstable link references with stable ones (httpBatchStreamLink and httpSubscriptionLink) to ensure consistency in client creation and streaming operations.
www/docs/{client/links/httpBatchLink.md, client/links/httpBatchStreamLink.md, client/links/httpSubscriptionLink.md, server/merging-routers.md} Updated documentation to reflect the renaming of unstable links to stable versions and to add new configuration options (maxURLLength, maxItems), as well as aligning lazy-loading examples with the new API.

Sequence Diagram(s)

sequenceDiagram
    participant Client as TRPC Client
    participant Split as SplitLink Handler
    participant Batch as httpBatchStreamLink
    participant Subscription as httpSubscriptionLink
    participant Server as Backend Server

    Client->>Split: Send operation request
    alt Subscription Operation
        Split->>Subscription: Call httpSubscriptionLink(...)
        Subscription->>Server: Process subscription request
    else Normal Operation
        Split->>Batch: Call httpBatchStreamLink(...)
        Batch->>Server: Process batch streaming request
    end
Loading
sequenceDiagram
    participant Dev as Developer
    participant RouterLoader as Router Loader
    participant Lazy as lazy() Function
    participant Err as Error Handler

    Dev->>RouterLoader: Load router module using lazy()
    RouterLoader->>Lazy: Validate and load router module
    alt Module Valid
        Lazy->>Dev: Router loaded successfully
    else Validation Fails
        Lazy->>Err: Emit error with updated message referencing lazy()
        Err->>Dev: Notify incorrect usage
    end
Loading

Possibly related PRs

Suggested labels

♻️ autoupdate

Suggested reviewers

  • KATT

Poem

Oh, what a hop, what a sprint so fleet,
The unstable paths now feel complete.
I’ve swapped the old for links that gleam,
With httpBatchStreamLink shining like a dream.
From lazy hops to stable streams that flow,
This rabbit cheers as our code does grow!
🐇✨


🪧 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.
  • @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.

@railway-app railway-app bot temporarily deployed to trpc-pr-6617 March 19, 2025 11:02 Destroyed
@railway-app
Copy link

railway-app bot commented Mar 19, 2025

🚅 Deployed to the trpc-pr-6617 environment in trpc-sse-and-websockets

Service Status Web Updated (UTC)
next-sse-chat ◻️ Removed (View Logs) Web Mar 21, 2025 at 10:39 am
next-prisma-websockets-starter ◻️ Removed (View Logs) Mar 21, 2025 at 10:39 am

trpc-bot
trpc-bot previously approved these changes Mar 21, 2025
# Conflicts:
#	packages/tanstack-react-query/test/useSubscription.test.tsx
@railway-app railway-app bot temporarily deployed to trpc-pr-6617 March 21, 2025 10:28 Destroyed
@railway-app railway-app bot temporarily deployed to trpc-pr-6617 March 21, 2025 10:28 Destroyed
@KATT KATT merged commit 0244dee into main Mar 21, 2025
99 of 106 checks passed
@KATT KATT deleted the issues/6582 branch March 21, 2025 10:39
Lms24 added a commit to getsentry/sentry-javascript that referenced this pull request Mar 21, 2025
trpc/trpc#6617 removed an unstable API we used
in the app. I just switched it over to use the stable replacement
@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 Mar 22, 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.

3 participants