feat(pinia-colada): Pinia Colada integration#1686
Conversation
…gins Port the Pinia Colada integration from the 1.x branch onto v2 client APIs, targeting @pinia/colada >= 1.0: - Keep the v1 public surface: buildKey, .key(), .call, .queryOptions(), .mutationOptions(), createORPCVueColadaUtils - Adopt v2 conventions from @orpc/tanstack-query: class-based ProcedureUtils / SharedRouterUtils and RECURSIVE_CLIENT_UNWRAP_KEYS guards in the router proxy - Use RPCJsonSerializer for entry keys, skipping serialization for undefined input (the v2 serializer maps undefined to null, which would break Pinia Colada partial key matching) - Port the tanstack-query interceptor & plugin system: query/mutation interceptors with operation context (VUE_COLADA_OPERATION_CONTEXT_SYMBOL), option modifiers, scoped per-procedure options, and orderable RouterUtilsPlugin composed via CompositeRouterUtilsPlugin Includes unit, type, and e2e tests with 100% coverage on all source files. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
More templates
@orpc/arktype
@orpc/bun
@orpc/client
@orpc/cloudflare
@orpc/contract
@orpc/experimental-effect
@orpc/evlog
@orpc/json-schema
@orpc/nest
@orpc/next
@orpc/openapi
@orpc/opentelemetry
@orpc/pinia-colada
@orpc/pino
@orpc/publisher
@orpc/ratelimit
@orpc/server
@orpc/shared
@orpc/tanstack-query
@orpc/trpc
@orpc/valibot
@orpc/zod
commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Reviewed changes — added the new
ℹ️
|
Reviewed changes — added the new
ℹ️
|
There was a problem hiding this comment.
test body
Kimi K2 (free via Pullfrog for OSS) | 𝕏
Reviewed changes — added the new
ℹ️
|
…s pattern
Align with Pinia Colada's built-in defineQueryOptions: queryOptions() and
mutationOptions() no longer accept MaybeRefOrGetter input/context values and
now return plain DefineQueryOptionsTagged / DefineMutationOptionsTagged
options (typed entry keys, no computed key). For reactive inputs, pass a
callback to useQuery — useQuery(() => orpc.x.queryOptions({ input: id.value }))
— matching the tanstack-query integration behavior and composing cleanly with
defineQueryOptions.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
ℹ️ No critical issues — reactivity moved to Pinia Colada's
defineQueryOptions/useQuerycallback pattern, and tests/typecheck/build all pass.
Reviewed changes — since the prior review, the integration was refactored to align with @pinia/colada >= 1.0's plain-value options pattern.
- Removed
MaybeRefOrGetterfromqueryOptions()/mutationOptions()input/context in favor of plain values; reactivity is now the caller's responsibility viauseQuery(() => …)/defineQueryOptions(...). - Updated type wrappers in
src/types.tsto useDefineQueryOptions/DefineQueryOptionsTaggedandUseMutationOptions/DefineMutationOptionsTagged. - Switched e2e and type tests to the callback form (e.g.
useQuery(() => pingQueryOptions(id.value))). - Added
@ts-expect-errortests asserting refs/getters are rejected for input and context.
ℹ️ Nitpicks
- Root
package.jsondevDependencies still doesn't list@orpc/vue-coladalike@orpc/nextand@orpc/tanstack-query.
Kimi K2 (free via Pullfrog for OSS) | 𝕏
Add ProcedureUtils.infiniteOptions built on Pinia Colada's useInfiniteQuery: input as a (pageParam) => input function (matching the tanstack-query integration), required initialPageParam/getNextPageParam passthrough, entry keys generated with type 'infinite' from the initial page param, and plain DefineInfiniteQueryOptionsTagged output composing with useInfiniteQuery callback form and defineInfiniteQueryOptions. Includes dedicated infiniteInterceptors (root, scoped, plugin-injected) and an infiniteOptions modifier, wired through the same merge order as query and mutation interceptors. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
ℹ️ No critical issues — minor suggestions inline.
Reviewed changes — added infinite query support on top of the v2 Pinia Colada port and merged latest main.
- Added
.infiniteOptions()toProcedureUtilswithDefineInfiniteQueryOptionsinput anduseInfiniteQuery-compatible output. - Added
infiniteInterceptorsandinfiniteOptionsmodifiers, wired throughRouterUtilsOptions, scoped options, and plugin composition. - Updated
OperationTypeandbuildKeyto include'infinite'entries. - Added unit,
.test-d.ts, and e2e coverage for infinite queries. - Merged latest
maininto the branch.
Kimi K2 (free via Pullfrog for OSS) | 𝕏
Add standalone key builders on procedure utils, mirroring the tanstack-query
integration: .queryKey() and .infiniteKey() return EntryKeyTagged keys so
cache reads like queryCache.getQueryData infer data types, and .mutationKey()
returns the same key (or per-input key function) used by .mutationOptions.
Each accepts a { key } override and has a matching queryKey/infiniteKey/
mutationKey modifier in ProcedureUtilsOptions (usable via scoped options and
plugins). The *Options builders now route through these methods so key
modifiers apply consistently everywhere.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Drop the public RouterUtilsOptions.path option (the recursion path is now
purely internal) and add a dedicated prefix option instead. When set, the
prefix becomes the first element of every entry key —
[prefix, path, { input, type }] — so multiple router utils mounted over the
same client cannot collide, and partial key matching (invalidation, cache
reads) never crosses between prefixed and un-prefixed instances.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Extract BuildKeyPrefixOptions and carry prefix through ProcedureUtilsOptions and the SharedRouterUtils options object instead of extra constructor parameters, and drop redundant toArray wrapping around interceptor lists.
Rename @orpc/vue-colada to @orpc/pinia-colada to match the name of the library it integrates with. Public names follow: createPiniaColadaUtils (replacing createORPCVueColadaUtils, aligned with createTanstackQueryUtils), PINIA_COLADA_OPERATION_CONTEXT_SYMBOL and PiniaColadaOperationContext. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add .streamedOptions and .liveOptions (with .streamedKey/.liveKey) for AsyncIteratorObject procedures, ported from the tanstack-query integration. Chunks are published progressively through the query entry's public state ref: streamed queries accumulate chunks into an array (with refetchMode reset/append/replace and maxChunks via fnOptions, included in the entry key), while live queries replace the result with each new chunk. Both come with dedicated interceptors, option/key modifiers, scoped and plugin support, and 'streamed'/'live' operation context types. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Bring the streamed/live e2e cases up to the same rigor as the regular useQuery case: typesafe error handling, partial key invalidation matching by operation type, gated chunks so intermediate streaming states are asserted deterministically (first chunk visible while the stream is still open), append-mode refetch with maxChunks, and reactive input switching to a fresh entry via the useQuery callback form. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…a Colada Replace the fake-entry unit tests for serializableStreamedQuery and liveQuery with tests that mount real useQuery components backed by a real query cache, proving users actually observe streamed data live: chunks appear (or replace the value) reactively while asyncStatus is still loading, driven by manually gated streams. Covers all refetch modes, maxChunks, reset-to-pending on refetch, the empty live stream error, and cancellation via queryCache.cancelQueries keeping already-received data without an error. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Move the real-Pinia-Colada tests for serializableStreamedQuery and liveQuery from tests/ back next to their source files as src/*.test.tsx, with the mount and chunk-stream helpers inlined per file instead of imported from a shared module. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The integration is not tied to defineQueryOptions/defineInfiniteQueryOptions; document the option utilities against useQuery/useInfiniteQuery/useMutation only and keep the reactive-inputs guidance to the useQuery callback form. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — adds the @orpc/pinia-colada integration package with query/mutation option builders, streamed/live/infinite query support, key utilities, plugins, interceptors, scoped defaults, and documentation.
- Add
@orpc/pinia-coladapackage — builders foruseQuery,useInfiniteQuery, anduseMutationthat accept plain-value options, plus.key()/.queryKey()/.streamedKey()/.liveKey()/.infiniteKey()/.mutationKey()helpers. - Streamed and live query support —
serializableStreamedQueryaccumulatesAsyncIteratorObjectchunks andliveQuerypublishes the latest chunk, both validated with real Pinia Colada + Vue component tests. - Router-shaped utilities and plugins —
createPiniaColadaUtilsproduces a recursive proxy mirroring the router, supportsprefix,scopeddefaults, interceptor chains, and orderedRouterUtilsPluginhooks. - Add integration docs and sidebar entry — new
apps/content/docs/integrations/pinia-colada.mdcovers setup, options, keys, reactivity, interceptors, plugins, and operation context.
Kimi K2 (free via Pullfrog for OSS) | 𝕏

Summary
Adds
@orpc/pinia-colada, the Pinia Colada integration for oRPC v2 (successor of v1's@orpc/vue-colada), plus a documentation page.What you get
.queryOptions,.streamedOptions,.liveOptions,.infiniteOptions, and.mutationOptionsforuseQuery,useInfiniteQuery, anduseMutation, working with both the direct and callback (() => options) forms and composing withdefineQueryOptions/defineInfiniteQueryOptionsdefineQueryOptionspattern — reactivity happens at theuseQuerycall siterefetchModeandmaxChunks), live queries always show the latest chunk.keyfor partial matching (invalidation), plus.queryKey/.streamedKey/.liveKey/.infiniteKey/.mutationKeyreturning tagged keys so cache reads likequeryCache.getQueryDatainfer data typesDate,URL,BigInt, ...) work in keys out of the boxprefixoption to mount multiple utils over the same client without key collisions@orpc/tanstack-query: interceptors, per-procedurescopeddefaults, plugins, and an operation context for configuring links per operation type@pinia/colada>= 1.0Tests
Unit, type, and e2e tests (real Vue components against an
RPCHandler-backed client) with 100% coverage on all source files.