npm @orpc/tanstack-query 2.0.0-beta.48
v2.0.0-beta.48

4 hours ago

Highlights

This beta adds a cookie jar for clients outside the browser, HEAD support for GET procedures, a streaming option for batch responses, and a new OpenAPI router. One breaking change affects custom OpenAPI error responses.

import { BatchLinkPlugin, CookieJarLinkPlugin } from '@orpc/client/plugins'
import { HeadMethodHandlerPlugin } from '@orpc/server/plugins'

// Server: answer HEAD with the matching GET procedure's status and headers
const handler = new OpenAPIHandler(router, {
  plugins: [new HeadMethodHandlerPlugin()],
})

// Client: keep cookies in SSR, scripts, and tests, and stream batch responses
const link = new RPCLink({
  origin,
  url: '/rpc',
  plugins: [
    new CookieJarLinkPlugin({ origin }),
    new BatchLinkPlugin({
      mode: 'streaming', // default: 'buffered'
      groups: [{ condition: () => true, context: {} }],
    }),
  ],
})
  • Cookie Jar: CookieJarLinkPlugin stores cookies servers set and sends them back, like a browser. Docs
  • HEAD method: HeadMethodHandlerPlugin answers HEAD with the matching GET procedure, without the body. Docs
  • Batch response modes: buffered (default) keeps headers and cookies; streaming sends each response as soon as it is ready. Docs
  • OpenAPI router: routing now uses @openapi-spec/router, which matches OpenAPI path templates directly. Only edge cases change: overlapping routes rank literal > param > catch-all per segment, empty segments are kept, and the first duplicate route wins. Docs
  • Breaking: returning null or undefined from errorResponseBodyEncoder, errorResponseBodyDecoder, or errorResponseBodySchema no longer falls back to the default. Call error.toJSON(), defaultError(), or defaultSchema() instead. Handler · Link

   🚨 Breaking Changes

   🚀 Features

   🐞 Bug Fixes

    View changes on GitHub

Don't miss a new tanstack-query release

NewReleases is sending notifications on new releases.