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

Ensure subscriptions adhere to the errorPolicy #11162

Merged
merged 10 commits into from
Aug 28, 2023

Conversation

jerelmiller
Copy link
Member

@jerelmiller jerelmiller commented Aug 24, 2023

Fixes #10559

Errors returned in subscriptions payloads are always thrown, regardless of the error policy. With this change, the next function is now called if the errorPolicy is set to all or ignore. In the case of ignore, the errors property is stripped off the result.

NOTE: Protocol errors are still thrown regardless of the error policy. According to our docs, errorPolicy only changes how GraphQL errors are handled.

NOTE: useSubscription and subscribeToMore do not currently allow errorPolicy as a valid option, so these are not tested with this change. Since that is technically a new "feature", I've opted to wait to add this functionality in a patch release and instead will consider this as part of the next minor release. See #11165 to track the progress on this missing functionality.

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 24, 2023

🦋 Changeset detected

Latest commit: 6110dc3

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

@github-actions
Copy link
Contributor

github-actions bot commented Aug 24, 2023

size-limit report 📦

Path Size
dist/apollo-client.min.cjs 37.18 KB (+0.05% 🔺)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/main.cjs" 43.65 KB (+0.05% 🔺)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/main.cjs" (production) 42.27 KB (+0.04% 🔺)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/index.js" 32.41 KB (+0.05% 🔺)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/index.js" (production) 31.23 KB (+0.09% 🔺)
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%)
import { useSuspenseQuery } from "dist/react/index.js" (production) 4.16 KB (0%)
import { useBackgroundQuery } from "dist/react/index.js" 4.26 KB (0%)
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 jerelmiller marked this pull request as ready for review August 24, 2023 21:33
Copy link
Contributor

@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.

@jerelmiller and I synced offline on this - LGTM 👍

@jerelmiller jerelmiller merged commit d9685f5 into main Aug 28, 2023
@jerelmiller jerelmiller deleted the issue-10559/error-policy-subscription branch August 28, 2023 21:31
This was referenced Aug 28, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 28, 2023
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.

React Native Uncaught Error, Network Request Failed
2 participants