-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Fix previousData lost with useLazyQuery and variable change #8459
Fix previousData lost with useLazyQuery and variable change #8459
Conversation
Thanks for this! If you’re planning on looking into this, I’m happy to help in any way, and if you want a maintainer to expedite a fix for the related bug, this is best way to do that! Either way, ping me and let me know! |
Hey @brainkim! I'm not too sure what the intended / correct behavior would look like, so perhaps its best for a maintainer to handle this. |
@grnnja I took a look at this and wrote a comment on the original issue. If you use the apollo-client/src/react/hooks/__tests__/useLazyQuery.test.tsx Lines 478 to 566 in 3667cbd
|
@brainkim Thanks for clearing this up, I didn't realize that |
This is a failing test for #7396. I based the new test on:
apollo-client/src/react/hooks/__tests__/useLazyQuery.test.tsx
Line 395 in 3161e31
The component in the new test rerenders an extra time between rerender 4 and rerender 5, where loading is still true, but it changes both data and previousData to undefined, which is the problem in #7396.
Checklist: