Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
genu opened this issue Nov 24, 2024 · 0 comments
Open

Comments

@genu
Copy link

genu commented Nov 24, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant