Skip to content

query-collection gcTime not set to underlaying query #1546

@fehmer

Description

@fehmer
  • I've validated the bug against the latest version of DB packages

Describe the bug

Hi, I am not sure this is an issue or intended behavior. Setting gcTimeon the queryCollectionOptions does not override the default gcTime on the tanstack/query.

This is my collection definition:

const collection = createCollection(
  queryCollectionOptions({
    queryKey: ["test"],
    staleTime: Infinity,
    gcTime: Infinity,
   queryClient,

Checking tanstack query devtools the query is still using the gcTimefrom the queryClient.

I do get this warning when the query is cleaned up:

[cleanupQueryIfIdle] Invariant violation: refcount=1 but no listeners. Cleaning up to prevent leak. {hashedQueryKey: '["test"]'}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions