Skip to content

Update API reference docs for links: part 2 - #12822

Merged
jerelmiller merged 53 commits into
release-4.0from
jerel/link-docs-2
Aug 6, 2025
Merged

Update API reference docs for links: part 2#12822
jerelmiller merged 53 commits into
release-4.0from
jerel/link-docs-2

Conversation

@jerelmiller

Copy link
Copy Markdown
Member

No description provided.

@changeset-bot

changeset-bot Bot commented Aug 4, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d6a21a9

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

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

commit: d6a21a9

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

@jerelmiller
jerelmiller force-pushed the jerel/more-link-docs branch 2 times, most recently from 90ba396 to ed28279 Compare August 5, 2025 14:47
@jerelmiller
jerelmiller force-pushed the jerel/more-link-docs branch from 201376e to 6e272c1 Compare August 5, 2025 16:17
Base automatically changed from jerel/more-link-docs to release-4.0 August 5, 2025 16:37
@github-actions

github-actions Bot commented Aug 5, 2025

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
import { ApolloClient, InMemoryCache, HttpLink } from "@apollo/client" (CJS) 42.88 KB (0%)
import { ApolloClient, InMemoryCache, HttpLink } from "@apollo/client" (production) (CJS) 37.65 KB (0%)
import { ApolloClient, InMemoryCache, HttpLink } from "@apollo/client" 32.77 KB (0%)
import { ApolloClient, InMemoryCache, HttpLink } from "@apollo/client" (production) 26.91 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%)

@jerelmiller

Copy link
Copy Markdown
Member Author

!docs set-base-branch release-4.0

@jerelmiller
jerelmiller marked this pull request as ready for review August 6, 2025 01:20
@jerelmiller
jerelmiller requested a review from a team as a code owner August 6, 2025 01:20
@jerelmiller
jerelmiller requested a review from phryneas August 6, 2025 01:20

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.

Much of this doc really should live in another part of the docs site, but given our limited time, let's do that a different time.

@phryneas phryneas left a comment

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.

This is great :)

Comment thread src/link/context/index.ts
Comment on lines +90 to +91
* return {
* // ...

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.

I would show setting at least one property here.

Suggested change
* return {
* // ...
* return {
* credentials: "include",
* // ...

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.

I'm not 100% sure, but maybe it might even sense to show something with a bit of type safety here in case users cannot enhance their global operation type?

const link = new SetContextLink((prevContext, operation) => {
  return {
    credentials: "include",
  } satisfies Partial<HttpLink.ContextOptions>;
});

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 might go the simple route for now and revisit once I write up the TypeScript declaration merging section for context (hopefully later today 🙂). Ideally I can link to that in this doc block.

Comment on lines +44 to +46
* import { sha256 } from "crypto-hash";
*
* const link = new PersistedQueryLink({ sha256 });

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.

We could show using the subtle crypto API that's both supported in the browser and node at this point:
https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest#basic_example

Comment thread docs/source/api/link/apollo-link-context.mdx Outdated
@github-actions github-actions Bot added the auto-cleanup 🤖 label Aug 6, 2025
jerelmiller and others added 2 commits August 6, 2025 08:58
Co-authored-by: Lenz Weber-Tronic <lorenz.weber-tronic@apollographql.com>
@jerelmiller
jerelmiller merged commit 103664d into release-4.0 Aug 6, 2025
43 of 44 checks passed
@jerelmiller
jerelmiller deleted the jerel/link-docs-2 branch August 6, 2025 16:01
@github-actions github-actions Bot mentioned this pull request Aug 6, 2025
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Sep 6, 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