Skip to content

Unify all link types - #12823

Merged
jerelmiller merged 25 commits into
release-4.0from
jerel/more-unify-types
Aug 5, 2025
Merged

Unify all link types#12823
jerelmiller merged 25 commits into
release-4.0from
jerel/more-unify-types

Conversation

@jerelmiller

Copy link
Copy Markdown
Member

Ensures link types are all namespaced. Discovered while working on #12822

@jerelmiller
jerelmiller requested a review from phryneas August 4, 2025 22:09
@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@12823

commit: b5c3403

@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%)
import { ApolloClient, InMemoryCache, HttpLink } from "@apollo/client" (production) (CJS) 37.72 KB (0%)
import { ApolloClient, InMemoryCache, HttpLink } from "@apollo/client" 32.76 KB (0%)
import { ApolloClient, InMemoryCache, HttpLink } from "@apollo/client" (production) 26.92 KB (0%)
import { ApolloProvider } from "@apollo/client/react" 5.9 KB (0%)
import { ApolloProvider } from "@apollo/client/react" (production) 971 B (0%)
import { useQuery } from "@apollo/client/react" 7.21 KB (0%)
import { useQuery } from "@apollo/client/react" (production) 2.23 KB (0%)
import { useLazyQuery } from "@apollo/client/react" 7.1 KB (0%)
import { useLazyQuery } from "@apollo/client/react" (production) 2.13 KB (0%)
import { useMutation } from "@apollo/client/react" 6.45 KB (0%)
import { useMutation } from "@apollo/client/react" (production) 1.48 KB (0%)
import { useSubscription } from "@apollo/client/react" 6.78 KB (0%)
import { useSubscription } from "@apollo/client/react" (production) 1.8 KB (0%)
import { useSuspenseQuery } from "@apollo/client/react" 8.58 KB (0%)
import { useSuspenseQuery } from "@apollo/client/react" (production) 3.63 KB (0%)
import { useBackgroundQuery } from "@apollo/client/react" 8.33 KB (0%)
import { useBackgroundQuery } from "@apollo/client/react" (production) 3.38 KB (0%)
import { useLoadableQuery } from "@apollo/client/react" 8.28 KB (0%)
import { useLoadableQuery } from "@apollo/client/react" (production) 3.36 KB (0%)
import { useReadQuery } from "@apollo/client/react" 6.59 KB (0%)
import { useReadQuery } from "@apollo/client/react" (production) 1.63 KB (0%)
import { useFragment } from "@apollo/client/react" 6.65 KB (0%)
import { useFragment } from "@apollo/client/react" (production) 1.69 KB (0%)

@changeset-bot

changeset-bot Bot commented Aug 4, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b5c3403

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

export interface RetryFunctionOptions extends CallbackOptions {}
export interface DisableFunctionOptions extends CallbackOptions {}
export interface DisableFunctionOptions
extends PersistedQueryLink.RetryFunctionOptions {}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This felt more appropriate because disable is called with the retry options object.

@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: e570edf557b672968d52a7d8
Build Logs: View logs

(count: number, operation: ApolloLink.Operation, error: any): number;
}

export interface DelayFunctionOptions {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I renamed this type from DelayFunctionOptions to DelayOptions in the namespaced type since this isn't actually used as part of a function call. These are used as:

new RetryLink({
  delay: {
    initial: ...,
    max: ...,
    jitter: ...
  }
})

So the "Function" part of the name seemed confusing.

): boolean | Promise<boolean>;
}

export interface RetryFunctionOptions {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Same here. Removed the "Function" part of RetryFunctionOptions for clarity.

* Configuration for the retry strategy to use, or a custom retry strategy.
*/
attempts?: RetryFunctionOptions | RetryFunction;
attempts?: RetryLink.AttemptsOptions | RetryLink.AttemptsFunction;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Since the option here is called attempts, I renamed the function type to AttemptsFunction and the options object to AttemptsOptions to avoid confusion.

Comment thread src/link/retry/retryLink.ts Outdated
Comment thread src/link/retry/retryLink.ts Outdated
Comment thread src/link/retry/retryLink.ts Outdated
Comment thread src/link/retry/retryLink.ts Outdated
Comment thread src/link/retry/retryLink.ts Outdated
Comment thread src/link/persisted-queries/index.ts
Comment on lines -11 to -15
export interface ErrorHandler {
// (undocumented)
(options: ErrorHandlerOptions): Observable<ApolloLink.Result> | void;
}

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.

The call here is generally to drop all the old Types?
I'm for it, just gotta be really thorough with the codemod.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I thought so since we've done it with others

@github-actions github-actions Bot added the auto-cleanup 🤖 label Aug 5, 2025
@jerelmiller
jerelmiller merged commit 19e315e into release-4.0 Aug 5, 2025
44 checks passed
@jerelmiller
jerelmiller deleted the jerel/more-unify-types branch August 5, 2025 16:02
@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