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

Fix issue where a bare install had some issues with a @types/node import in some cases #11141

Merged
merged 5 commits into from
Aug 10, 2023

Conversation

jerelmiller
Copy link
Member

@jerelmiller jerelmiller commented Aug 10, 2023

Fixes #11132

Moves the response iterator helpers over to the http link where they are used and removes them from @apollo/client/utilities. These helpers were added in an alpha of 3.8 and thus were not exported in versions <= 3.7.x.

This is technically a breaking change by removing a public export, but its been 3 days since we released 3.8. The alternative is to make @types/node either a dependency or a peer dependency, both of which feel a bit odd given that Apollo Client is used primarily in the browser.

Checklist:

  • If this PR contains changes to the library itself (not necessary for e.g. docs updates), please include a changeset (see CONTRIBUTING.md)
  • If this PR is a new feature, please reference an issue where a consensus about the design was reached (not necessary for small changes)
  • Make sure all of the significant new logic is covered by tests

@changeset-bot
Copy link

changeset-bot bot commented Aug 10, 2023

🦋 Changeset detected

Latest commit: 8fb8e30

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

@jerelmiller jerelmiller changed the title Types node fetch issue Fix issue where a bare install had some issues with a @types/node import in some cases Aug 10, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Aug 10, 2023

size-limit report 📦

Path Size
dist/apollo-client.min.cjs 37.16 KB (0%)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/main.cjs" 43.62 KB (-0.16% 🔽)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/main.cjs" (production) 42.24 KB (-0.13% 🔽)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/index.js" 32.39 KB (-0.01% 🔽)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/index.js" (production) 31.21 KB (-0.03% 🔽)
import { ApolloProvider } from "dist/react/index.js" 1.21 KB (0%)
import { ApolloProvider } from "dist/react/index.js" (production) 1.2 KB (0%)
import { useQuery } from "dist/react/index.js" 4.29 KB (0%)
import { useQuery } from "dist/react/index.js" (production) 4.1 KB (0%)
import { useLazyQuery } from "dist/react/index.js" 4.59 KB (0%)
import { useLazyQuery } from "dist/react/index.js" (production) 4.41 KB (0%)
import { useMutation } from "dist/react/index.js" 2.52 KB (0%)
import { useMutation } from "dist/react/index.js" (production) 2.5 KB (0%)
import { useSubscription } from "dist/react/index.js" 2.23 KB (0%)
import { useSubscription } from "dist/react/index.js" (production) 2.19 KB (0%)
import { useSuspenseQuery } from "dist/react/index.js" 4.73 KB (-0.03% 🔽)
import { useSuspenseQuery } from "dist/react/index.js" (production) 4.16 KB (0%)
import { useBackgroundQuery } from "dist/react/index.js" 4.25 KB (+0.03% 🔺)
import { useBackgroundQuery } from "dist/react/index.js" (production) 3.67 KB (0%)
import { useReadQuery } from "dist/react/index.js" 2.94 KB (0%)
import { useReadQuery } from "dist/react/index.js" (production) 2.88 KB (0%)
import { useFragment } from "dist/react/index.js" 2.07 KB (0%)
import { useFragment } from "dist/react/index.js" (production) 2.02 KB (0%)

@jerelmiller
Copy link
Member Author

/release:pr

@github-actions
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

@alessbell alessbell left a comment

Choose a reason for hiding this comment

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

Thanks for getting a PR up here so quickly @jerelmiller, this LGTM. These utilities were accidentally publicly exported and are causing a bug by virtue of the way some code was reorganized. I'm strongly in favor of removing them quickly in a patch.

As an aside, I remembered using one these utilities (isAsyncIterableIterator) in a custom BatchHttpLink I wrote for a user trying to integrate Apollo Client with a HotChocolate server which uses the multipart response format for batched requests, and realized we also removed readJsonBody in a prerelease via #11040. This was also an inadvertent breaking change, but it's reasonably simple to modify any userland code, likely in custom links, that's using readJsonBody. With this snapshot I was able to test my changes and opened a PR on the multipart BatchHttpLink implementation: https://github.com/erwan-joly/BatchPoc/pull/3/files. Sharing here in case it's useful to anyone who finds this PR.

@jerelmiller jerelmiller merged commit c469b16 into main Aug 10, 2023
8 checks passed
@jerelmiller jerelmiller deleted the types-node-fetch-issue branch August 10, 2023 16:34
@github-actions github-actions bot mentioned this pull request Aug 10, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

apollo-client 3.8.0 has non-declared dependency on @types/node-fetch
2 participants