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

PersistedQueryLink: also check for extension error codes #10807

Merged
merged 3 commits into from
Jun 14, 2023
Merged

Conversation

phryneas
Copy link
Member

This one fixes #10253

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 Apr 25, 2023

🦋 Changeset detected

Latest commit: dd53bcc

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

@phryneas phryneas self-assigned this Apr 25, 2023
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.

Looks great! So sorry this one slipped past us for so long.

Had a couple minor nits, but overall the PR looks good. Thanks for addressing!

@github-actions
Copy link
Contributor

github-actions bot commented Jun 14, 2023

size-limit report 📦

Path Size
dist/apollo-client.min.cjs 33.66 KB (0%)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/main.cjs" 42.39 KB (0%)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/index.js" 33.47 KB (0%)
import { ApolloProvider } from "dist/react/index.js" 917 B (0%)
import { useQuery } from "dist/react/index.js" 24.96 KB (0%)
import { useLazyQuery } from "dist/react/index.js" 25.26 KB (0%)
import { useMutation } from "dist/react/index.js" 23.5 KB (0%)
import { useSubscription } from "dist/react/index.js" 2.43 KB (0%)
import { useFragment_experimental } from "dist/react/index.js" 1.84 KB (0%)

@netlify
Copy link

netlify bot commented Jun 14, 2023

Deploy Preview for apollo-client-docs ready!

Name Link
🔨 Latest commit dd53bcc
🔍 Latest deploy log https://app.netlify.com/sites/apollo-client-docs/deploys/64898f1b7ad91d0008c5de01
😎 Deploy Preview https://deploy-preview-10807--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 settings.

export namespace PersistedQueryLink {
interface BaseOptions {
disable?: (error: ErrorResponse) => boolean;
disable?: (error: ErrorResponse, errorsByMessageAndCode: ErrorsByMessageAndCode) => boolean;
Copy link
Member

Choose a reason for hiding this comment

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

@phryneas @jerelmiller If I understand correctly, ErrorResponse is a type that basically literally is "the argument to this disable function" and isn't used for anything else. So it would seem reasonable to add errorsByMessage and errorsByCode directly to it rather than adding a second argument? The fact that the one instantiation of this type is called disablePayload seems telling...

if (errorMessages.PersistedQueryNotSupported) {
if (
byMessage.PersistedQueryNotSupported ||
byCode[PERSISTED_QUERY_NOT_SUPPORTED]
Copy link
Member

Choose a reason for hiding this comment

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

not clear why byMessage is using . here and byCode is indirecting through a const and using [] but 🤷

@glasser
Copy link
Member

glasser commented Jun 22, 2023

I see both of my comments are addressed in #10806 :)

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 22, 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.

Persisted queries link should look at error code extension, not just message
3 participants