Skip to content

Commit

Permalink
Merge pull request #437 from apollographql/main
Browse files Browse the repository at this point in the history
Create a new pull request by comparing changes across two branches
  • Loading branch information
GulajavaMinistudio authored Mar 1, 2024
2 parents aac4951 + fc949bb commit e810375
Show file tree
Hide file tree
Showing 7 changed files with 179 additions and 142 deletions.
38 changes: 19 additions & 19 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,25 @@

- [#11412](https://github.com/apollographql/apollo-client/pull/11412) [`58db5c3`](https://github.com/apollographql/apollo-client/commit/58db5c3295b88162f91019f0898f6baa4b9cced6) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add the ability to start preloading a query outside React to begin fetching as early as possible. Call `createQueryPreloader` to create a `preloadQuery` function which can be called to start fetching a query. This returns a `queryRef` which is passed to `useReadQuery` and suspended until the query is done fetching.

```tsx
const preloadQuery = createQueryPreloader(client);
const queryRef = preloadQuery(QUERY, { variables, ...otherOptions });

function App() {
return {
<Suspense fallback={<div>Loading</div>}>
<MyQuery />
</Suspense>
}
}

function MyQuery() {
const { data } = useReadQuery(queryRef);

// do something with data
}
```

#### Testing utility improvements

- [#11178](https://github.com/apollographql/apollo-client/pull/11178) [`4d64a6f`](https://github.com/apollographql/apollo-client/commit/4d64a6fa2ad5abe6f7f172c164f5e1fc2cb89829) Thanks [@sebakerckhof](https://github.com/sebakerckhof)! - Support re-using of mocks in the MockedProvider
Expand Down Expand Up @@ -193,25 +212,6 @@

The `IGNORE` sentinel can be destructured from the second parameter in the callback function signature passed to `optimisticResponse`.

```tsx
const preloadQuery = createQueryPreloader(client);
const queryRef = preloadQuery(QUERY, { variables, ...otherOptions });

function App() {
return {
<Suspense fallback={<div>Loading</div>}>
<MyQuery />
</Suspense>
}
}

function MyQuery() {
const { data } = useReadQuery(queryRef);

// do something with data
}
```

#### Network adapters for multipart subscriptions usage with Relay and urql

- [#11301](https://github.com/apollographql/apollo-client/pull/11301) [`46ab032`](https://github.com/apollographql/apollo-client/commit/46ab032af83a01f184bfcce5edba4b55dbb2962a) Thanks [@alessbell](https://github.com/alessbell)! - Add multipart subscription network adapters for Relay and urql
Expand Down
2 changes: 1 addition & 1 deletion docs/shared/useSuspenseQuery-result.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ A function that enables you to re-execute the query, optionally passing in new `

To guarantee that the refetch performs a network request, its `fetchPolicy` is set to `network-only` (unless the original query's `fetchPolicy` is `no-cache` or `cache-and-network`, which also guarantee a network request).

Calling this function will cause the component to re-suspend, , unless the call site is wrapped in [`startTransition`](https://react.dev/reference/react/startTransition).
Calling this function will cause the component to re-suspend, unless the call site is wrapped in [`startTransition`](https://react.dev/reference/react/startTransition).

</td>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion docs/source/caching/advanced-topics.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ For details, see [Refetching queries](../data/mutations/#refetching-queries).
<Note>
Although `refetchQueries` can be faster to implement than an `update` function, it also requires additional network requests that are usually undesirable. For more information, see [this blog post](https://www.apollographql.com/blog/when-to-use-refetch-queries-in-apollo-client/).
Although `refetchQueries` can be faster to implement than an `update` function, it also requires additional network requests that are usually undesirable. For more information, see [this blog post](https://www.apollographql.com/blog/when-to-use-refetch-queries/).
</Note>
Expand Down
2 changes: 1 addition & 1 deletion docs/source/data/suspense.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ const PARTIAL_GET_DOG_QUERY: TypedDocumentNode<
// Write partial data for Buck to the cache
// so it is available when Dog renders
client.writeQuery({
query: GET_DOG_QUERY_PARTIAL,
query: PARTIAL_GET_DOG_QUERY,
variables: { id: "1" },
data: { dog: { id: "1", name: "Buck" } },
});
Expand Down
151 changes: 94 additions & 57 deletions integration-tests/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e810375

Please sign in to comment.