Skip to content

Conversation

ryanagillie
Copy link
Contributor

@ryanagillie ryanagillie commented Oct 5, 2025

Tanstack Query recently updated (5.89.0) to pass another parameter to its onError callbacks, which wasn't being forwarded on correctly when using this package. It was capturing and forwarding them on one-by-one (omitting the new one). Now, it just captures the error parameter and spreads the rest. This will future-proof it if any more parameters are added or the order changes (assuming error is always the first one).

Summary by CodeRabbit

  • Bug Fixes

    • Improved reliability of error handling during SSR queries and mutations, reducing missed or malformed error callbacks in edge cases.
    • Preserves existing redirect behavior while ensuring original error callbacks continue to run when present.
  • Refactor

    • Streamlined error handler integration to better accommodate additional arguments from underlying libraries without altering public APIs or user-facing behavior.

Copy link
Contributor

coderabbitai bot commented Oct 5, 2025

Walkthrough

Updated SSR query error handlers to accept variadic parameters and forward all received arguments to original onError callbacks, without changing redirect handling or public APIs.

Changes

Cohort / File(s) Summary
SSR query error handling
packages/router-ssr-query-core/src/index.ts
Refactored MutationCache and QueryCache onError handlers to use rest parameters and forward all extra arguments to original handlers while preserving redirect logic.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant C as Client Code
  participant MQ as MutationCache
  participant QQ as QueryCache
  participant SSR as SSR Handler
  participant OG as Original onError

  rect rgb(245,248,255)
    note over MQ,SSR: Mutation error flow (updated arg forwarding)
    C->>MQ: mutation error occurs
    MQ->>SSR: onError(...args)
    alt is redirect
      SSR-->>C: trigger redirect
    else not redirect
      SSR->>OG: onError(...args)
      OG-->>SSR: return
    end
  end

  rect rgb(245,255,245)
    note over QQ,SSR: Query error flow (updated arg forwarding)
    C->>QQ: query error occurs
    QQ->>SSR: onError(...args)
    alt is redirect
      SSR-->>C: trigger redirect
    else not redirect
      SSR->>OG: onError(...args)
      OG-->>SSR: return
    end
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • schiller-manuel

Poem

I twitch my whiskers, hop with cheer,
Errors now pass all args we hear.
Redirects still leap in line,
Queries, mutations—doing fine.
With ellipses packed and tidy too,
I nibble bugs—then bid adieu. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title clearly describes the primary change—fixing the rest parameters behavior in the react-router-ssr-query package—and directly corresponds to the adjustments made in the error handlers without including unnecessary details.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

nx-cloud bot commented Oct 5, 2025

View your CI Pipeline Execution ↗ for commit 241100b

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ✅ Succeeded 1m 34s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 9s View ↗

☁️ Nx Cloud last updated this comment at 2025-10-05 23:50:37 UTC

Copy link

pkg-pr-new bot commented Oct 5, 2025

More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/arktype-adapter@5379

@tanstack/directive-functions-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/directive-functions-plugin@5379

@tanstack/eslint-plugin-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/eslint-plugin-router@5379

@tanstack/history

npm i https://pkg.pr.new/TanStack/router/@tanstack/history@5379

@tanstack/nitro-v2-vite-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/nitro-v2-vite-plugin@5379

@tanstack/react-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router@5379

@tanstack/react-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-devtools@5379

@tanstack/react-router-ssr-query

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-ssr-query@5379

@tanstack/react-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start@5379

@tanstack/react-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-client@5379

@tanstack/react-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-server@5379

@tanstack/router-cli

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-cli@5379

@tanstack/router-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-core@5379

@tanstack/router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools@5379

@tanstack/router-devtools-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools-core@5379

@tanstack/router-generator

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-generator@5379

@tanstack/router-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-plugin@5379

@tanstack/router-ssr-query-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-ssr-query-core@5379

@tanstack/router-utils

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-utils@5379

@tanstack/router-vite-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-vite-plugin@5379

@tanstack/server-functions-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/server-functions-plugin@5379

@tanstack/solid-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router@5379

@tanstack/solid-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-devtools@5379

@tanstack/solid-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start@5379

@tanstack/solid-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-client@5379

@tanstack/solid-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-server@5379

@tanstack/start-client-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-client-core@5379

@tanstack/start-plugin-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-plugin-core@5379

@tanstack/start-server-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-core@5379

@tanstack/start-static-server-functions

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-static-server-functions@5379

@tanstack/start-storage-context

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-storage-context@5379

@tanstack/valibot-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/valibot-adapter@5379

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/TanStack/router/@tanstack/virtual-file-routes@5379

@tanstack/zod-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/zod-adapter@5379

commit: 241100b

@ryanagillie ryanagillie changed the title Fix rest Parameters of react-router-ssr-query Fix Rest Parameters of react-router-ssr-query Oct 5, 2025
@schiller-manuel schiller-manuel changed the title Fix Rest Parameters of react-router-ssr-query fix: fix Rest Parameters of react-router-ssr-query Oct 6, 2025
@schiller-manuel schiller-manuel merged commit 9d38c38 into TanStack:main Oct 6, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants