query: Infinite render loop with v4.29.{22,23}

Describe the bug

Renovate is trying to update react-query from v4.29.19 to latest (this currently pulls v4.29.23) in our application monorepo containing multiple large React apps and a helper package. We have lots of tests entering infinite render loop, with the usual Maximum call stack exceeded error that React is throwing.

I can’t give you more details yet, I’m opening the issue early to gather community feedback. I will be able to provide more information on Monday, but as I’m not expecting any breaking change in a patch release, I though it would be useful to keep you posted.

I’m not even sure this is a problem with react-query, it’s just that this happens while upgrading this library.

Cheers, David

Your minimal, reproducible example

To be done

Steps to reproduce

To be done

Expected behavior

Tests pass as with v4.29.19

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

Linux JSDOM through Jest tests

Tanstack Query adapter

react-query

TanStack Query version

v4.29.23

TypeScript version

No response

Additional context

The problem is in unit tests only.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 4
  • Comments: 26 (4 by maintainers)

Most upvoted comments

No playwright test issues with this fix anymore. Thank you. 😃

Fix confirmed 👍 Thanks for handling this so quikly 🎉

@GiftedMediaBJ @justin-kucerak @kevindice we’re still waiting on either a standalone reproduction of the issue or a failing test case that we can run in isolation to debug the issue. Would be great if anyone could provide that please.

@TkDodo You are right, sorry for the confusion, the problem starts with 22.

I also don’t think that it is a firefox issue anymore. It just happens in firefox, because the tests in firefox are always a little bit slower, and together with the library update they are running in the timeout.

hmm, @incepter do you know why making getNextPageParam referentially stable would be required?

The commit didn’t address the getNextPageParam direclty, and I was also unable to find anywhere where we compare previous and the new getNextPageParam

@ddolcimascolo you’re the second person to state that wrapping it in useCallback fixed the issue, so it does look like it’s on our end. If that’s the case, it should be reproducible in codesandbox

I verified that tests are using inlined functions and are running correctly, a codesandbox reproduction will be highly appreciated