Skip to content

Remove ClientParseError type and use JSON.stringify in place of serializeFetchParameter - #12825

Merged
jerelmiller merged 5 commits into
release-4.0from
jerel/client-parse-error
Aug 5, 2025
Merged

Remove ClientParseError type and use JSON.stringify in place of serializeFetchParameter#12825
jerelmiller merged 5 commits into
release-4.0from
jerel/client-parse-error

Conversation

@jerelmiller

Copy link
Copy Markdown
Member

Replaces the call to serializeFetchParameter with JSON.stringify directly. This removes the ClientParseError type as a result in favor of throwing the json stringify error directly.

@jerelmiller
jerelmiller requested a review from phryneas August 4, 2025 22:44
@apollo-librarian

apollo-librarian Bot commented Aug 4, 2025

Copy link
Copy Markdown
Contributor

⚠️ Docs preview not attached to branch

The preview was not built because the PR's base branch release-4.0 is not in the list of sources.

An Apollo team member can comment one of the following commands to dictate which branch to attach the preview to:

  • !docs set-base-branch version-2.6
  • !docs set-base-branch main

Build ID: 1e0aa26e52ad38704b3400b8
Build Logs: View logs

@pkg-pr-new

pkg-pr-new Bot commented Aug 4, 2025

Copy link
Copy Markdown
npm i https://pkg.pr.new/apollographql/apollo-client/@apollo/client@12825

commit: 200a4ec

@github-actions

github-actions Bot commented Aug 4, 2025

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
import { ApolloClient, InMemoryCache, HttpLink } from "@apollo/client" (CJS) 42.77 KB (-0.61% 🔽)
import { ApolloClient, InMemoryCache, HttpLink } from "@apollo/client" (production) (CJS) 37.72 KB (-0.22% 🔽)
import { ApolloClient, InMemoryCache, HttpLink } from "@apollo/client" 32.76 KB (-0.2% 🔽)
import { ApolloClient, InMemoryCache, HttpLink } from "@apollo/client" (production) 26.92 KB (-0.26% 🔽)
import { ApolloProvider } from "@apollo/client/react" 5.9 KB (-0.71% 🔽)
import { ApolloProvider } from "@apollo/client/react" (production) 971 B (0%)
import { useQuery } from "@apollo/client/react" 7.21 KB (-0.42% 🔽)
import { useQuery } from "@apollo/client/react" (production) 2.23 KB (+0.05% 🔺)
import { useLazyQuery } from "@apollo/client/react" 7.1 KB (-0.44% 🔽)
import { useLazyQuery } from "@apollo/client/react" (production) 2.13 KB (0%)
import { useMutation } from "@apollo/client/react" 6.45 KB (-0.31% 🔽)
import { useMutation } from "@apollo/client/react" (production) 1.48 KB (0%)
import { useSubscription } from "@apollo/client/react" 6.78 KB (-0.45% 🔽)
import { useSubscription } from "@apollo/client/react" (production) 1.8 KB (0%)
import { useSuspenseQuery } from "@apollo/client/react" 8.58 KB (-0.32% 🔽)
import { useSuspenseQuery } from "@apollo/client/react" (production) 3.63 KB (0%)
import { useBackgroundQuery } from "@apollo/client/react" 8.33 KB (-0.41% 🔽)
import { useBackgroundQuery } from "@apollo/client/react" (production) 3.38 KB (0%)
import { useLoadableQuery } from "@apollo/client/react" 8.28 KB (-0.61% 🔽)
import { useLoadableQuery } from "@apollo/client/react" (production) 3.36 KB (0%)
import { useReadQuery } from "@apollo/client/react" 6.59 KB (-0.51% 🔽)
import { useReadQuery } from "@apollo/client/react" (production) 1.63 KB (0%)
import { useFragment } from "@apollo/client/react" 6.65 KB (-0.4% 🔽)
import { useFragment } from "@apollo/client/react" (production) 1.69 KB (0%)

"@apollo/client": major
---

The `serializeFetchParameter` helper is no longer exported and `JSON.stringify` is used directly. As such, the `ClientParseError` type has also been removed in favor of throwing any JSON serialize errors directly.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That's a good call. Yes, the error messages from JSON.stringify suck, but it's not worth the extra complexity of maintaining an additional error and shipping out extra bundle size.

@github-actions github-actions Bot added the auto-cleanup 🤖 label Aug 5, 2025
@changeset-bot

changeset-bot Bot commented Aug 5, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ffa09b8

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

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 merged commit 292b949 into release-4.0 Aug 5, 2025
33 checks passed
@jerelmiller
jerelmiller deleted the jerel/client-parse-error branch August 5, 2025 15:11
@github-actions github-actions Bot mentioned this pull request Aug 5, 2025
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Sep 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants