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

docs: minor 3.9 docs copyedits #11636

Merged
merged 2 commits into from
Mar 5, 2024
Merged

docs: minor 3.9 docs copyedits #11636

merged 2 commits into from
Mar 5, 2024

Conversation

Meschreiber
Copy link
Contributor

@Meschreiber Meschreiber commented Mar 1, 2024

Very minor copyedits on 3.9 docs—mostly breaking up long sentences and paragraphs and making things more concise. (Sorry it took me so long to get to them!)

As a side note, I was able to review the Cache Sizes doc earlier, but am just noticing the double quotations on some of the cache options. Is this intended?

image

Copy link

changeset-bot bot commented Mar 1, 2024

⚠️ No Changeset found

Latest commit: 1be62ac

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@@ -1,6 +1,6 @@
---
title: Suspense
description: Using React 18 Suspense features with Apollo Client
description: Use React 18 Suspense features with Apollo Client
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This matches the tense of the other pages in the Fetching section.

@@ -70,13 +70,21 @@ function Dog({ id }: DogProps) {
}
```

> **Note:** This example manually defines TypeScript interfaces for `Data` and `Variables` as well as the type for `GET_DOG_QUERY` using `TypedDocumentNode`. [GraphQL Code Generator](https://www.the-guild.dev/graphql/codegen) is a popular tool that creates these type definitions automatically for you. See the reference on [Using TypeScript](../development-testing/static-typing) for more information on integrating GraphQL Code Generator with Apollo Client.
<Note>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since 3.9 docs introduced the component, I figured we should standardize at least throughout this page.

Copy link
Contributor

github-actions bot commented Mar 1, 2024

size-limit report 📦

Path Size
dist/apollo-client.min.cjs 38.29 KB (0%)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/main.cjs" 46.11 KB (0%)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/main.cjs" (production) 43.66 KB (0%)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/index.js" 33.9 KB (0%)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/index.js" (production) 31.82 KB (0%)
import { ApolloProvider } from "dist/react/index.js" 1.23 KB (0%)
import { ApolloProvider } from "dist/react/index.js" (production) 1.22 KB (0%)
import { useQuery } from "dist/react/index.js" 5.26 KB (0%)
import { useQuery } from "dist/react/index.js" (production) 4.35 KB (0%)
import { useLazyQuery } from "dist/react/index.js" 5.5 KB (0%)
import { useLazyQuery } from "dist/react/index.js" (production) 4.58 KB (0%)
import { useMutation } from "dist/react/index.js" 3.51 KB (0%)
import { useMutation } from "dist/react/index.js" (production) 2.73 KB (0%)
import { useSubscription } from "dist/react/index.js" 3.19 KB (0%)
import { useSubscription } from "dist/react/index.js" (production) 2.38 KB (0%)
import { useSuspenseQuery } from "dist/react/index.js" 5.36 KB (0%)
import { useSuspenseQuery } from "dist/react/index.js" (production) 4.03 KB (0%)
import { useBackgroundQuery } from "dist/react/index.js" 4.83 KB (0%)
import { useBackgroundQuery } from "dist/react/index.js" (production) 3.49 KB (0%)
import { useLoadableQuery } from "dist/react/index.js" 4.98 KB (0%)
import { useLoadableQuery } from "dist/react/index.js" (production) 3.63 KB (0%)
import { useReadQuery } from "dist/react/index.js" 3.12 KB (0%)
import { useReadQuery } from "dist/react/index.js" (production) 3.06 KB (0%)
import { useFragment } from "dist/react/index.js" 2.25 KB (0%)
import { useFragment } from "dist/react/index.js" (production) 2.2 KB (0%)

We begin fetching our `GET_DOG_QUERY` by calling the `loadDog` function inside of the `onChange` handler function when a dog is selected. Once the network request is initiated, the `queryRef` is no longer `null` which renders the `Dog` component. In the `Dog` component, `useReadQuery` suspends the component while the network request finishes, then returns `data` to the component. As a result of this change, we've also eliminated the need to track the selected dog `id` in component state!
We begin fetching our `GET_DOG_QUERY` by calling the `loadDog` function inside of the `onChange` handler function when a dog is selected. Once the network request is initiated, the `queryRef` is no longer `null`, rendering the `Dog` component.

`useReadQuery` suspends the `Dog` component while the network request finishes, then returns `data` to the component. As a result of this change, we've also eliminated the need to track the selected dog `id` in component state.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just breaking up a longer paragraph.


</ExperimentalFeature>

Starting with Apollo Client `3.9.0`, queries can be initiated outside of React. This allows your app to begin fetching data _before_ React renders your components, and can provide performance benefits.
Starting with Apollo Client `3.9.0`, queries can be initiated outside of React. This allows your app to begin fetching data before React renders your components, and can provide performance benefits.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Due to feedback from our docs consultants, we're pulling back on text treatment and reserving italics for new terms and bold for UI elements. (See Text formatting in Style guide.)

Copy link

netlify bot commented Mar 1, 2024

Deploy Preview for apollo-client-docs ready!

Name Link
🔨 Latest commit 1be62ac
🔍 Latest deploy log https://app.netlify.com/sites/apollo-client-docs/deploys/65e767cd2441c00008a81d08
😎 Deploy Preview https://deploy-preview-11636--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 configuration.

@Meschreiber Meschreiber marked this pull request as ready for review March 1, 2024 23:08
@Meschreiber Meschreiber requested a review from a team as a code owner March 1, 2024 23:08
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.

Thanks so much for going through this!

And yes, those quoted strings are important to avoid confusion on how to define it. The properties are declared as:

{
  "queryManager.getDocumentInfo": 1000
}

Rather than something like:

{
  queryManager: {
    getDocumentInfo: 1000
  }
}

Those quotes help provide a hint at this structure.

@github-actions github-actions bot added the auto-cleanup 🤖 label Mar 5, 2024
@jerelmiller jerelmiller merged commit e9fd314 into main Mar 5, 2024
33 checks passed
@jerelmiller jerelmiller deleted the docs/edit-3.9-docs branch March 5, 2024 19:02
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 8, 2024
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