Skip to content

refetchOnFocus removing cached values despite 'keepUnusedDataFor' being set. #3117

@mattoni

Description

@mattoni

I have a situation that seems unexpected to me. I have a query with 'keepUnusedDataFor' set to 30 minutes (the length of something expiring in the API). I also have 'refetchOnFocus: true' set for my whole API, but disabled for this specific query.

If I keep focus on the window, the token lasts in cache like I want despite no subscriptions to it. However, if I lose focus and later (within the 30 minutes) regain focus, my value is cleared out of cache. No new fetch is done, as expected, but losing the value on focus is not what I intend.

Is this a bug, or is there something I'm not configuring correctly?

The query:

    const [getSshCreds, sshCreds] = useLazyGetSshConnectionQuery({
        refetchOnFocus: false,
        refetchOnReconnect: false,
    });

The settings:
image

The api service:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions