Skip to content
Source
Sign inSign up
TanStack/query

Double fetch call in basic useage #10015

Send to my agent
Closedartem-malko(GitHub profile, opens in a new tab) opened this issue 4 comments

Describe the bug

I have a base example of react-query usage. Event without React StrictMode. So, I have a button which toggles a visibility of a block with react-query. Also, I have a lot of logs from React, from API mock and so on. Looks like react-query calls api more than one time.

Your minimal, reproducible example

https://codesandbox.io/p/sandbox/xr795v

Steps to reproduce

  1. Go to the sandbox
  2. Click to "Toggle fetch data"
  3. Check the console

Expected behavior

Just one console.log with text Fetch in progress. It is the log from api mock.

How often does this bug happen?

Every time

Screenshots or Videos

Image

Platform

It doesn't matter

Tanstack Query adapter

None

TanStack Query version

v5.90.9

TypeScript version

v4.4.4

Additional context

It's just strange, cause I created a quite basic example, which is not working as I expected.

  1. This is what I see in the console of your reproduction. All good.

    Image
  2. TkDodo closed this

  3. TkDodo added labelsinvalid

  4. @TkDodo hm, pls, try several times

  5. I tried a bunch of times and it’s not happening. please make sure it’s not a browser extension or anything meddling with things

Sign in to join this conversation.