Skip to content
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

feat: extract watchFragment into separate method on ApolloCache #11465

Merged
merged 30 commits into from
Mar 18, 2024

Conversation

alessbell
Copy link
Member

@alessbell alessbell commented Jan 5, 2024

Closes #11348.

Initial refactor of useFragment's call to cache.watch into separate watchFragment method on the cache.

Copy link

changeset-bot bot commented Jan 5, 2024

🦋 Changeset detected

Latest commit: 46c8eb7

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

Copy link
Contributor

github-actions bot commented Jan 5, 2024

size-limit report 📦

Path Size
dist/apollo-client.min.cjs 38.48 KB (+0.4% 🔺)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/main.cjs" 46.34 KB (+0.41% 🔺)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/main.cjs" (production) 43.9 KB (+0.42% 🔺)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/index.js" 34.14 KB (+0.55% 🔺)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/index.js" (production) 32.02 KB (+0.49% 🔺)
import { ApolloProvider } from "dist/react/index.js" 1.23 KB (0%)
import { ApolloProvider } from "dist/react/index.js" (production) 1.22 KB (0%)
import { useQuery } from "dist/react/index.js" 5.26 KB (0%)
import { useQuery } from "dist/react/index.js" (production) 4.35 KB (0%)
import { useLazyQuery } from "dist/react/index.js" 5.5 KB (0%)
import { useLazyQuery } from "dist/react/index.js" (production) 4.58 KB (0%)
import { useMutation } from "dist/react/index.js" 3.51 KB (0%)
import { useMutation } from "dist/react/index.js" (production) 2.73 KB (0%)
import { useSubscription } from "dist/react/index.js" 3.19 KB (0%)
import { useSubscription } from "dist/react/index.js" (production) 2.38 KB (0%)
import { useSuspenseQuery } from "dist/react/index.js" 5.36 KB (0%)
import { useSuspenseQuery } from "dist/react/index.js" (production) 4.03 KB (0%)
import { useBackgroundQuery } from "dist/react/index.js" 4.83 KB (0%)
import { useBackgroundQuery } from "dist/react/index.js" (production) 3.49 KB (0%)
import { useLoadableQuery } from "dist/react/index.js" 4.98 KB (0%)
import { useLoadableQuery } from "dist/react/index.js" (production) 3.63 KB (0%)
import { useReadQuery } from "dist/react/index.js" 3.12 KB (0%)
import { useReadQuery } from "dist/react/index.js" (production) 3.06 KB (0%)
import { useFragment } from "dist/react/index.js" 2.29 KB (+1.35% 🔺)
import { useFragment } from "dist/react/index.js" (production) 2.23 KB (+1.29% 🔺)

@alessbell alessbell added auto-cleanup 🤖 🥚 backwards-compatible for PRs that do not introduce any breaking changes 🧞‍♂️ enhancement labels Jan 5, 2024
@alessbell alessbell added this to the Release 3.10 milestone Jan 5, 2024
@alessbell alessbell force-pushed the issue-11348-extract-watchFragment branch from f23c7e1 to f122e0b Compare January 5, 2024 19:20
Copy link
Member

@jerelmiller jerelmiller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am so stoked about this one! I think this will lay some great groundwork for the fragment features we want to release in 3.10 as well as providing this API to non-React devs. Thanks for starting this!

Left some initial feedback based on its current state 🙂

src/cache/core/cache.ts Outdated Show resolved Hide resolved
src/cache/core/cache.ts Show resolved Hide resolved
src/cache/core/cache.ts Outdated Show resolved Hide resolved
src/cache/core/cache.ts Outdated Show resolved Hide resolved
src/cache/core/cache.ts Outdated Show resolved Hide resolved
src/core/ApolloClient.ts Outdated Show resolved Hide resolved
src/cache/core/cache.ts Show resolved Hide resolved
src/core/ApolloClient.ts Outdated Show resolved Hide resolved
src/react/hooks/useFragment.ts Outdated Show resolved Hide resolved
@alessbell
Copy link
Member Author

Thanks for the speedy review, @jerelmiller! Will make these changes and push up some more tests shortly :)

@alessbell alessbell force-pushed the issue-11348-extract-watchFragment branch from fe7bb96 to 67c1e1c Compare January 12, 2024 21:46
@alessbell

This comment was marked as outdated.

This comment was marked as outdated.

@alessbell
Copy link
Member Author

/release:pr

Copy link
Contributor

A new release has been made for this PR. You can install it with npm i @apollo/[email protected].

@alessbell alessbell force-pushed the issue-11348-extract-watchFragment branch from 13fa56e to 07568d1 Compare March 12, 2024 19:22
Copy link

netlify bot commented Mar 12, 2024

Deploy Preview for apollo-client-docs ready!

Name Link
🔨 Latest commit 07568d1
🔍 Latest deploy log https://app.netlify.com/sites/apollo-client-docs/deploys/65f0ab6c8e47f6000876b60a
😎 Deploy Preview https://deploy-preview-11465--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.

Copy link

netlify bot commented Mar 12, 2024

Deploy Preview for apollo-client-docs ready!

Name Link
🔨 Latest commit 46c8eb7
🔍 Latest deploy log https://app.netlify.com/sites/apollo-client-docs/deploys/65f88562b175680008e7b774
😎 Deploy Preview https://deploy-preview-11465--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.

@alessbell alessbell marked this pull request as ready for review March 12, 2024 21:01
@alessbell alessbell requested review from a team as code owners March 12, 2024 21:01
@alessbell
Copy link
Member Author

Not sure why Netlify build is failing with "Error: error:0308010C:digital envelope routines::unsupported", will take a look in a bit.

@alessbell
Copy link
Member Author

/release:pr

Copy link
Contributor

A new release has been made for this PR. You can install it with:

npm i @apollo/[email protected]

Copy link
Member

@jerelmiller jerelmiller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So excited to get this in! Thanks for pushing this along 🙂.

src/react/hooks/useFragment.ts Outdated Show resolved Hide resolved
src/react/hooks/useFragment.ts Outdated Show resolved Hide resolved
src/core/ApolloClient.ts Outdated Show resolved Hide resolved
src/core/ApolloClient.ts Outdated Show resolved Hide resolved
src/cache/core/cache.ts Outdated Show resolved Hide resolved
src/cache/core/cache.ts Outdated Show resolved Hide resolved
src/__tests__/ApolloClient.ts Show resolved Hide resolved
src/__tests__/ApolloClient.ts Show resolved Hide resolved
Copy link
Member

@jerelmiller jerelmiller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 This looks great! Really looking forward to getting this out there 🙂

@alessbell alessbell merged commit 7623da7 into release-3.10 Mar 18, 2024
37 checks passed
@alessbell alessbell deleted the issue-11348-extract-watchFragment branch March 18, 2024 19:02
@alessbell alessbell removed this from the Release 3.10 milestone Apr 5, 2024
@github-actions github-actions bot mentioned this pull request Apr 24, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-cleanup 🤖 🥚 backwards-compatible for PRs that do not introduce any breaking changes 🧞‍♂️ enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants