Skip to content

Suspense causes application to hang in SSR context when query is disabled #8345

Description

@genu

Describe the bug

When a query is disabled, calling suspense() in SSR context causes hang.

Your minimal, reproducible example

https://stackblitz.com/edit/tanstack-query-5ck7qt?file=app.vue

Steps to reproduce

const fetcher = async () =>
  await fetch('https://jsonplaceholder.typicode.com/posts').then((response) =>
    response.json()
  );

const { data, suspense } = useQuery({
  queryKey: ['test'],
  queryFn: fetcher,
  enabled: false,
});

onServerPrefetch(async () => {
  await suspense(); // <-- Causes hang
});

Expected behavior

When query is disabled, I expect suspense() not to hang the application

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

Universal

Tanstack Query adapter

vue-query

TanStack Query version

5.61.3

TypeScript version

No response

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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