Skip to content

Repeated useSuspenseQuery firing when providing gcTime of more than 24 days #10264

@gersomvg

Description

@gersomvg

Describe the bug

Related: #9454

When you do a useSuspenseQuery with a gcTime > 24 days, the gcTime seems to default to 0. A low gcTime in combination with useSuspenseQuery causes many refetches.

The main issue here is that there is no warning that gcTime can't be more than 24 days. There is a mention in the docs but no intellisense/jsdoc and no runtime error.

I would say that a better default is to cast anything over 24 days to 24 days, unless a custom timeout provider is set.

Your minimal, reproducible example

No repro needed as the issue is already confirmed in the related issue as a known issue.

Steps to reproduce

Run a useSuspenseQuery with gcTime: 3_000_000_000 in a boundary

Expected behavior

  • I expect more warnings or better jsdoc regarding the max of 24 days for gctime.
  • I expect anything higher than 24 days to be casted to 24 days precisely, instead of 0

How often does this bug happen?

None

Screenshots or Videos

No response

Platform

  • MacOS
  • Safari
  • "@tanstack/react-query": "^5.90.16"

Tanstack Query adapter

react-query

TanStack Query version

v5.90.16

TypeScript version

v5.9.0

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