Skip to content

Suspense query is retried infinitely with low gcTime #7853

@foxable

Description

@foxable

Describe the bug

I'm using useSuspenseQuery with retry: false and a low gcTime (started with 0, but the same problem can be observed for gcTimes which are generally lower than 1s. When the query throws an error, it is retried infinitely, or at least multiple times with a low gcTime which is not 0.

Your minimal, reproducible example

https://github.com/foxable/reproduction-react-query-suspense-infinite-retry/tree/main

Steps to reproduce

  1. Run npm run dev
  2. Open http://localhost:3000/

Expected behavior

I expected the query to run only once on both the server and the client, but on the client it is retried infinitely (the same happens on the server when setting gcTime: 0.

Setting retryOnMount: false does not change this behavior.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

  • OS: Linux
  • Browser: Firefox, Chrome

Tanstack Query adapter

react-query

TanStack Query version

v5.51.21

TypeScript version

v5.5.4

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions