Skip to content

refetchOnFocus: Unintended refetch when iframe exists in the page #4533

Closed

Description

In my React project I'm using RTK-Query with refetchOnFocus enabled globally.
This is for ensuring fresh data on UI when users keep the app open in the browser all the time, and has been working fine.

The problem I'm encountered with is that this option generates unwanted refetches every time after users interact with components built with the iframe element. While this technically makes sense, I can hardly think of a point in refetches after interacting with the iframe.

I'm hoping focus events via iframes to be excluded from the condition to trigger refetches, but according to my quick survey, it seems it's impossible to tell whether the focus event comes from an iframe or else.
For my use case, visibilitychange on the window object is probably closer to the event I'd like to trigger refetches on.

I'd like to know what the maintainers think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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