apollographql / apollo-client

:rocket:  A fully-featured, production ready caching GraphQL client for every UI framework and GraphQL server.
https://apollographql.com/client
MIT License
19.34k stars 2.66k forks source link

refactor useQuery to not use an internal class #11869

Closed phryneas closed 2 months ago

phryneas commented 4 months ago

After #11890, I'm fairly confident in this now.

This needs to be reviewed commit-by commit, although a bunch of merges added additional commits at the start and end - I'm really sorry for those! (I believe some of them will disappear here if #11890 gets merged first!)

There might be more PRs to further streamline the result handling, but I think this PR is big enough as it is right now.

changeset-bot[bot] commented 4 months ago

🦋 Changeset detected

Latest commit: 33c0fefeb33dee9cec281e12dad1c949b473d6fb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | -------------- | ----- | | @apollo/client | Minor |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

github-actions[bot] commented 4 months ago

size-limit report 📦

Path Size
dist/apollo-client.min.cjs 38.89 KB (+0.52% 🔺)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/main.cjs" 47.63 KB (+0.31% 🔺)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/main.cjs" (production) 45.17 KB (+0.21% 🔺)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/index.js" 34.22 KB (-0.01% 🔽)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/index.js" (production) 32.08 KB (-0.01% 🔽)
import { ApolloProvider } from "dist/react/index.js" 1.26 KB (0%)
import { ApolloProvider } from "dist/react/index.js" (production) 1.24 KB (0%)
import { useQuery } from "dist/react/index.js" 5.2 KB (-2.19% 🔽)
import { useQuery } from "dist/react/index.js" (production) 4.28 KB (-2.67% 🔽)
import { useLazyQuery } from "dist/react/index.js" 5.68 KB (+1.42% 🔺)
import { useLazyQuery } from "dist/react/index.js" (production) 4.75 KB (+1.83% 🔺)
import { useMutation } from "dist/react/index.js" 3.59 KB (+0.03% 🔺)
import { useMutation } from "dist/react/index.js" (production) 2.81 KB (+0.04% 🔺)
import { useSubscription } from "dist/react/index.js" 3.63 KB (+0.03% 🔺)
import { useSubscription } from "dist/react/index.js" (production) 2.78 KB (+0.04% 🔺)
import { useSuspenseQuery } from "dist/react/index.js" 5.47 KB (0%)
import { useSuspenseQuery } from "dist/react/index.js" (production) 4.12 KB (0%)
import { useBackgroundQuery } from "dist/react/index.js" 4.98 KB (-0.02% 🔽)
import { useBackgroundQuery } from "dist/react/index.js" (production) 3.63 KB (0%)
import { useLoadableQuery } from "dist/react/index.js" 5.04 KB (0%)
import { useLoadableQuery } from "dist/react/index.js" (production) 3.69 KB (0%)
import { useReadQuery } from "dist/react/index.js" 3.35 KB (+0.03% 🔺)
import { useReadQuery } from "dist/react/index.js" (production) 3.3 KB (0%)
import { useFragment } from "dist/react/index.js" 2.32 KB (0%)
import { useFragment } from "dist/react/index.js" (production) 2.27 KB (0%)
netlify[bot] commented 3 months ago

Deploy Preview for apollo-client-docs ready!

Name Link
Latest commit 33c0fefeb33dee9cec281e12dad1c949b473d6fb
Latest deploy log https://app.netlify.com/sites/apollo-client-docs/deploys/6686b3fab7f2da00083f95be
Deploy Preview https://deploy-preview-11869--apollo-client-docs.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

jerelmiller commented 3 months ago

I've done a commit-by-commit look through this PR, but I'd like to wait to fully comment on this until you've had a chance to merge the base branches into this one. I think this contains changes from a couple other PRs, so its difficult to tell whats from that and whats from the other branches.

Once that is done, I should be able to get a quick review submitted. Thanks!

phryneas commented 3 months ago

Did a bunch of cherry-picking and history rewriting - it should be good now!