Skip to content

Infinite Query runs twice on initial load with React 18 #3492

Closed
@woischi

Description

@woischi

Describe the bug

I'm currently using the latest Beta version of React Query with React 18 and noticed my Infinite Query to fetch the initial page two times. As soon as I switch to the React 17 DOM setup, everything works fine.

I added a minimal reproduction example.

Your minimal, reproducible example

https://codesandbox.io/s/restless-firefly-zq2cmo

Steps to reproduce

Open the network tab, refresh the Browser output and see two API calls.

Expected behavior

Just one time would be great.

How often does this bug happen?

No response

Screenshots or Videos

No response

Platform

...

react-query version

v4.0.0-beta.1

TypeScript version

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions