-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Infinite render loop with v4.29.{22,23} #5719
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I can confirm we're having a similar issue with next Downgrading to |
@iscekic can you show a reproduction please? |
and, can you narrow down in which RQ version the issue first occurred ? We do one patch release per issue, so if you can tell me exactly which release between |
I don't have a minimal repro, but I did manage to fix the issue using the latest version. Seems like the culprit was the |
react-query doesn't require |
Hi guys, same on my side after spending the morning trying to do a minimal reproduction in a codesandbox. We did have a non-stable function passed as an event handler in one of our components. Wrapping it in a I didn't manage to reproduce in isolation though, so I'd accept that the issue was on my side, though it's still strange that a patch release did introduce the behavior... The Renovate MR is now merged, the issue can be closed I suppose. Thx for the help |
I've bissected and the culprit commit is 15dceab3 (PR #5573) introduced in 4.19.22 |
hmm, @incepter do you know why making
@ddolcimascolo you're the second person to state that wrapping it in |
The commit didn't address the getNextPageParam direclty, and I was also unable to find anywhere where we compare previous and the new getNextPageParam
I verified that tests are using inlined functions and are running correctly, a codesandbox reproduction will be highly appreciated |
Yeah, I've tried but no luck... I will try to again when I get some free time |
We are (maybe) also running into this issue after upgrading from v4.29.19 to v4.29.25. After upgrade, our playwright tests are running into timeouts in firefox. In chromium, everything still works fine. The issues start if we use v4.29.21. Using v4.29.19 or v4.29.20 does not make any problems. I also don't have a minimal repo at hand, but maybe this information can help to narrow down the cause of this issues a bit. |
That's intriguing
Can you please just copy a failing test and remove confidential parts, may be just the shape of the usage may hint us about the problematic. Does the test pass when you wrap in a useCallback hook like what others suggested ? |
@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. |
We upgraded to version 23 yesterday and had to roll it back after it kept getting one of our apps into infinite render loops. I can confirm that the issue was the |
Hi all, Our short-term solution was to remove 2 dependencies from the useEffect |
I cannot speak to why wrapping getNextPageParam in useCallback affects this behavior. However, I did notice that a deep comparison isn't being used in queryObserver line 837 which would unnecessarily return true, unless I am missing something. Seems like this could cause the QueryObserver class variable currentResult to change a lot which might explain the infinite loop. |
Same issue here |
@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 Here is my reproducible example https://codesandbox.io/s/confident-visvesvaraya-t8hzwk?file=/src/App.js. With |
I confirm that there is an infinite loop. Downgrading to |
@incepter I think it would be best if we reverted the PR that introduced the issue until we can find the root cause for it ? |
@TkDodo of course go ahead, i ll look into it too. |
No playwright test issues with this fix anymore. Thank you. :) |
Fix confirmed 👍 Thanks for handling this so quikly 🎉 |
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.
The text was updated successfully, but these errors were encountered: