Skip to content

bug(tanstack-react-query): subscriptionOptions remains enabled when a skip token is provided. #7373

@tmkx

Description

@tmkx

Provide environment information

System:
  OS: macOS 26.4.1
  CPU: (12) arm64 Apple M3 Pro
  Memory: 129.14 MB / 36.00 GB
  Shell: 5.9 - /bin/zsh
Binaries:
  Node: 24.4.1 - /Users/tmk/.local/share/mise/installs/node/24.4.1/bin/node
  npm: 11.4.2 - /Users/tmk/.local/share/mise/installs/node/24.4.1/bin/npm
  pnpm: 10.33.2 - /Users/tmk/.local/share/mise/installs/node/24.4.1/bin/pnpm
  bun: 1.3.13 - /opt/homebrew/bin/bun
  Deno: 2.7.14 - /opt/homebrew/bin/deno
Browsers:
  Chrome: 147.0.7727.138
  Safari: 26.4
npmPackages:
  @tanstack/react-query: ^5.100.9 => 5.100.9
  @trpc/client: ^11.17.0 => 11.17.0
  @trpc/server: ^11.17.0 => 11.17.0
  typescript: ^6.0.3 => 6.0.3

Describe the bug

subscriptionOptions(skipToken).enabled is true, expect false.

Link to reproduction

none

To reproduce

import { QueryClient, skipToken } from '@tanstack/query-core';
import { createTRPCClient } from '@trpc/client';
import { initTRPC } from '@trpc/server';
import { createTRPCOptionsProxy } from '@trpc/tanstack-react-query';

const t = initTRPC.create({
  isServer: true,
});

const appRouter = t.router({
  foo: t.router({
    bar: t.procedure.subscription(async function* () {
      yield 'hello';
    }),
  }),
});

type AppRouter = typeof appRouter;

const trpcClient = createTRPCClient<AppRouter>({
  links: [],
});

export const trpc = createTRPCOptionsProxy<AppRouter>({
  client: trpcClient,
  queryClient: new QueryClient(),
});

console.log(trpc.foo.bar.subscriptionOptions()); // ✅
console.log(trpc.foo.bar.subscriptionOptions(skipToken).enabled); // ❌, expect false

Additional information

No response

👨‍👧‍👦 Contributing

  • 🙋‍♂️ Yes, I'd be down to file a PR fixing this bug!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions