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

Better handle array types when unmasking #12150

Merged
merged 3 commits into from
Nov 20, 2024

Conversation

jerelmiller
Copy link
Member

@jerelmiller jerelmiller commented Nov 20, 2024

Found some additional type issues when trying this out with our Studio codebase. Opening this to track changes and try preview builds.

See #12150 (comment) for more info. tl;dr; it was an older version of TypeScript where we see this issue.

@svc-apollo-docs
Copy link

svc-apollo-docs commented Nov 20, 2024

✅ Docs Preview Ready

No new or changed pages found.

Copy link

changeset-bot bot commented Nov 20, 2024

🦋 Changeset detected

Latest commit: 4ce7924

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 Patch

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

pkg-pr-new bot commented Nov 20, 2024

npm i https://pkg.pr.new/@apollo/client@12150

commit: 4ce7924

Copy link
Contributor

github-actions bot commented Nov 20, 2024

size-limit report 📦

Path Size
dist/apollo-client.min.cjs 40.64 KB (0%)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/main.cjs" 50.8 KB (0%)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/main.cjs" (production) 47.68 KB (0%)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/index.js" 36.15 KB (0%)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/index.js" (production) 33.56 KB (0%)
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.21 KB (0%)
import { useQuery } from "dist/react/index.js" (production) 4.3 KB (0%)
import { useLazyQuery } from "dist/react/index.js" 5.71 KB (0%)
import { useLazyQuery } from "dist/react/index.js" (production) 4.78 KB (0%)
import { useMutation } from "dist/react/index.js" 3.62 KB (0%)
import { useMutation } from "dist/react/index.js" (production) 2.85 KB (0%)
import { useSubscription } from "dist/react/index.js" 4.43 KB (0%)
import { useSubscription } from "dist/react/index.js" (production) 3.48 KB (0%)
import { useSuspenseQuery } from "dist/react/index.js" 5.51 KB (0%)
import { useSuspenseQuery } from "dist/react/index.js" (production) 4.17 KB (0%)
import { useBackgroundQuery } from "dist/react/index.js" 5.01 KB (0%)
import { useBackgroundQuery } from "dist/react/index.js" (production) 3.66 KB (0%)
import { useLoadableQuery } from "dist/react/index.js" 5.09 KB (0%)
import { useLoadableQuery } from "dist/react/index.js" (production) 3.74 KB (0%)
import { useReadQuery } from "dist/react/index.js" 3.42 KB (0%)
import { useReadQuery } from "dist/react/index.js" (production) 3.36 KB (0%)
import { useFragment } from "dist/react/index.js" 2.37 KB (0%)
import { useFragment } from "dist/react/index.js" (production) 2.31 KB (0%)

@jerelmiller
Copy link
Member Author

Turns out that array types don't work well with Unmasked when working with older versions of TypeScript, so I'd like to get this fix in there for that. When using the existing helper type with an older version of TypeScript (I tried 5.0.3), it copies all array properties to the type (such as pop, push, etc), rather than iterating the fields on the array items. This is why I was having trouble reproducing it in a test since we are on a newer version of TypeScript that fixes whatever behavior caused this before.

@jerelmiller jerelmiller force-pushed the jerel/fix-additional-types branch from c460dfa to 565b049 Compare November 20, 2024 19:47
@jerelmiller jerelmiller marked this pull request as ready for review November 20, 2024 19:48
Copy link

netlify bot commented Nov 20, 2024

Deploy Preview for apollo-client-docs ready!

Name Link
🔨 Latest commit 565b049
🔍 Latest deploy log https://app.netlify.com/sites/apollo-client-docs/deploys/673e3cd811828900088b1806
😎 Deploy Preview https://deploy-preview-12150--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 Nov 20, 2024

Deploy Preview for apollo-client-docs ready!

Name Link
🔨 Latest commit 4ce7924
🔍 Latest deploy log https://app.netlify.com/sites/apollo-client-docs/deploys/673e3e7511828900088b44a6
😎 Deploy Preview https://deploy-preview-12150--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
Copy link
Member Author

Going to go ahead and get this merged in so we can get a new rc released. Can confirm this fixes the issue with the older version of TypeScript.

@jerelmiller jerelmiller merged commit 9ed1e1e into release-3.12 Nov 20, 2024
45 checks passed
@jerelmiller jerelmiller deleted the jerel/fix-additional-types branch November 20, 2024 20:18
@github-actions github-actions bot mentioned this pull request Nov 20, 2024
This was referenced Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants