You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As per title, updating to the latest version (3.3.10) should not cause any regression.
Actual outcome:
From what I was able to debug, when using useLazyQuery it seems that called is always false, causing the function to trigger the query to be called again and again.
PR #7655 changed this code so that the Promise.resolve().then(forceUpdate)
branch was not taken when queryDataRef.current was falsy, so forceUpdate()
was called immediately instead (the else branch).
As #7713 demonstrates, the Promise delay is important to avoid calling
forceUpdate() synchronously during the initial render, which can lead to
an infinite rendering loop.
To preserve the intent of #7655, we now do the queryDataRef.current check
inside the Promise callback, since the component could have been unmounted
before the callback fired.
@emmenko This should be fixed in @apollo/client@3.3.11, at least in the sense that it restores the v3.3.9 behavior (no infinite loop in your reproduction). As you probably are aware, your real code probably needs some additional logic to handle loading: true before using data, and React's <StrictMode/> renders components twice, which may be surprising. Let us know if you notice any other deviations from previous behavior, or any other surprising aspects of that behavior. Thanks!
Intended outcome:
As per title, updating to the latest version (
3.3.10
) should not cause any regression.Actual outcome:
From what I was able to debug, when using
useLazyQuery
it seems thatcalled
is alwaysfalse
, causing the function to trigger the query to be called again and again.Eventually we get this error from React
How to reproduce the issue:
If necessary, I'll try to create a reproduction. I wanted to report the issue first in case it's some known problem.
The text was updated successfully, but these errors were encountered: