Skip to content

refetch function returned by useQuery does not behave accordingly to docs #843

@lgenzelis

Description

@lgenzelis

Describe the bug
The docs (line 155) describe the refetch function returned by useQuery as having the signature refetch: Function({ force, throwOnError }) => void. This doesn't seem to be true, as refecth actually does not accept any argument at all.

Moreover, that same section of the docs say that the default behavior of refetch is fetching the query only if it is stale (which can supposedly be bypassed by passing {force: true}). This isn't right either. Calling refetch(with no arguments) always refetches de query, disregarding its status.

Expected behavior
I'd love to see refetch behaving as described in the docs, but if that cannot be easily fixed, it would be necessary to update the docs accordingly. So, refetch should be typed as refetch: () => void and the description should say that it always refetches the query (stale or not).

Additional context
I'm working in React Native, just in case. Still, browsing the source code didn't lead me to the behavior described in the docs.

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