-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
data is not available anymore in the onCompleted callback #11996
Comments
Hi @franbach 👋 Thanks for reporting this.
My intuition is that some of the refactoring work that @phryneas did to make
Yes, though in general we advise against doing any "post-processing" of Since const { data } = useQuery<MyQueryType, MyQueryVariablesType>(MY_QUERY, {
variables: { ... }
});
// you can use memoization to avoid re-computing `processedData` if `data` hasn't changed
const processedData = useMemo(() => process(data), [data]); I hope that's helpful! Let me know if you have any other questions, otherwise I'll go ahead and close this out :) |
Awesome! yes you can close it, thank you so much @alessbell :) |
Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo Client usage and allow us to serve you better. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Hello friends!
I'm trying to update to the latest Apollo version but I noticed a behavior that was not present in the version 3.10.8.
I believe this is not an ideal pattern but it's currently being used in the codebase I'm working on.
Works on 3.10.8
On the latest version,
data
is nowundefined
or at least after 3.10.8. I've read the changelog but it doesn't seem to mention this behavior change. I believe the right approach would be to just use the data thatonCompleted
gives us in return, like...I just want to understand what changed so I can explain it to my peers.
I appreciate any feedback!
Thanks, everyone :)
The text was updated successfully, but these errors were encountered: