Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix useLazyQuery forceUpdate loop regression.
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.
- Loading branch information