Skip to content

Commit

Permalink
Merge branch 'main' into pr/explore-10587
Browse files Browse the repository at this point in the history
  • Loading branch information
phryneas authored Mar 28, 2023
2 parents 18cb2f3 + a3f63a5 commit 169840f
Show file tree
Hide file tree
Showing 34 changed files with 1,717 additions and 1,317 deletions.
5 changes: 5 additions & 0 deletions .changeset/small-elephants-poke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@apollo/client": patch
---

Upgrades TypeScript to v5. This change is fully backward-compatible and transparent to users.
5 changes: 5 additions & 0 deletions .changeset/young-toes-sparkle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@apollo/client": patch
---

`useQuery`: delay unsubscribe to fix race conditions
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
jobs:
Filesize:
docker:
- image: cimg/node:19.6.0
- image: cimg/node:19.8.1
steps:
- checkout
- run: npm version
Expand All @@ -12,7 +12,7 @@ jobs:

Lint:
docker:
- image: cimg/node:19.6.0
- image: cimg/node:19.8.1
steps:
- checkout
- run: npm version
Expand All @@ -21,7 +21,7 @@ jobs:

Tests:
docker:
- image: cimg/node:19.6.0
- image: cimg/node:19.8.1
steps:
- checkout
- run: npm run ci:precheck
Expand Down
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@

### Checklist:

- [ ] If this PR contains changes to the library itself (not necessary for e.g. docs updates), please include a changeset (see [CONTRIBUTING.md](../CONTRIBUTING.md#changesets))
- [ ] If this PR contains changes to the library itself (not necessary for e.g. docs updates), please include a changeset (see [CONTRIBUTING.md](https://github.com/apollographql/apollo-client/blob/main/CONTRIBUTING.md#changesets))
- [ ] 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
2 changes: 1 addition & 1 deletion .github/workflows/close-stale-issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

steps:
- name: Close Stale Issues
uses: actions/stale@v7.0.0
uses: actions/stale@v8.0.0
with:
# # Token for the repository. Can be passed in using `{{ secrets.GITHUB_TOKEN }}`.
# repo-token: # optional, default is ${{ github.token }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/exit-prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ jobs:
uses: WyriHaximus/github-action-get-previous-tag@v1

- name: Remove 'v' prefix from version number (e.g. v1.0.0)
uses: mad9000/actions-find-and-replace-string@3
uses: mad9000/actions-find-and-replace-string@4
id: formatversion
with:
source: ${{ steps.previoustag.outputs.tag }}
find: "v"
replace: ""

- name: Write previous version to package.json
uses: jaywcjlove/github-action-package@v1.3.0
uses: jaywcjlove/github-action-package@v1.3.1
with:
version: ${{ steps.formatversion.outputs.value }}

Expand Down
13 changes: 4 additions & 9 deletions .github/workflows/lock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 'Lock Threads'

on:
schedule:
- cron: '0 * * * *'
- cron: '0 0 * * *'

permissions:
issues: write
Expand All @@ -20,17 +20,12 @@ jobs:
with:
github-token: ${{ github.token }}
log-output: true

issue-inactive-days: '30'
exclude-any-issue-labels: 'discussion'
# issue-comment: >
# This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
issue-comment: >
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
# Please note this issue tracker is not a help forum. We recommend using [StackOverflow](https://stackoverflow.com/questions/tagged/apollo-client) or our [discord server](https://discord.gg/graphos) for questions.
For general questions, we recommend using [StackOverflow](https://stackoverflow.com/questions/tagged/apollo-client) or our [discord server](https://discord.gg/graphos).
pr-inactive-days: '30'
exclude-any-pr-labels: 'discussion'
# pr-comment: >
# This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

# Please note this issue tracker is not a help forum. We recommend using [StackOverflow](https://stackoverflow.com/questions/tagged/apollo-client) or our [discord server](https://discord.gg/graphos) for questions.
5 changes: 4 additions & 1 deletion .github/workflows/snapshot-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@ jobs:
startsWith(github.event.comment.body, '/release:pr')
steps:
- uses: xt0rted/pull-request-comment-branch@v1
- uses: alessbell/pull-request-comment-branch@v1.1
id: comment-branch

- name: Checkout head ref
uses: actions/checkout@v3
with:
## specify the owner + repository in order to checkout the fork
## for community PRs
repository: ${{ steps.comment-branch.outputs.head_owner }}/${{ steps.comment-branch.outputs.head_repo }}
ref: ${{ steps.comment-branch.outputs.head_ref }}
fetch-depth: 0

Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @apollo/client

## 3.7.10

### Patch Changes

- [#9438](https://github.com/apollographql/apollo-client/pull/9438) [`52a9c8ea1`](https://github.com/apollographql/apollo-client/commit/52a9c8ea1ac08ee53fe1ddbd4ded899ea00a1f9f) Thanks [@dciesielkiewicz](https://github.com/dciesielkiewicz)! - Ensure the `client` option passed to `useMutation`'s execute function is used when provided. Previously this option was ignored.

- [#9124](https://github.com/apollographql/apollo-client/pull/9124) [`975b923c0`](https://github.com/apollographql/apollo-client/commit/975b923c0c0e7ddc8553917a91981e9f41713bc1) Thanks [@andrebrantom](https://github.com/andrebrantom)! - Make `ApolloClient.writeQuery` and `ApolloClient.writeFragment` behave more like `cache.writeQuery` and `cache.writeFragment` by returning the reference returned by the cache.

## 3.7.9

### Patch Changes
Expand Down
8 changes: 4 additions & 4 deletions ROADMAP.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 🔮 Apollo Client Roadmap

**Last updated: 2023-01-30**
**Last updated: 2023-03-07**

For up to date release notes, refer to the project's [Changelog](https://github.com/apollographql/apollo-client/blob/main/CHANGELOG.md).

Expand All @@ -15,7 +15,7 @@ For up to date release notes, refer to the project's [Changelog](https://github.

## [3.8.0](https://github.com/apollographql/apollo-client/milestone/30)

_Approximate Date: 2023-03-31_
_Approximate Date: 2023-04-14_

Currently in active development and being shipped in a series alpha releases. React 18 users will get a lot out of this release since it introduces support for Suspense and (for you server-side rendering enthusiasts) `renderToPipeableStream`. There are also new features added to the core as well. Here's a brief overview:

Expand All @@ -24,7 +24,7 @@ Currently in active development and being shipped in a series alpha releases. R
- Introduce another new hook `useBackgroundQuery` with `Suspense` support
- Ability to use `Suspense` with `useFragment`
- Server-side rendering (SSR) upgrade: support `renderToPipeableStream` for streaming renders
- Add the (opt-in) ability to access fields with the `@client` directive in the link chain
- Support custom GraphQL document transforms

As we release each new feature we'll be looking for feedback from the community on performance, usage and developer experience of adopting and implementing these new concepts in your applications. Try it today: `npm i @apollo/client@alpha` and let us know what you think! Once new feature development is complete we'll move this to beta and then GA once stable.

Expand All @@ -36,7 +36,7 @@ The 3.8 release is a major milestone for the project's React support. Feedback

## Demo app: Spotify clone

_Approximate Date: 2023-02-23_
_Approximate Date: 2023-03-08_

We are working on a full-stack Spotify clone to showcase and test the capabilities of Apollo Client 3.8. Right now it's a private repository that we're using to dogfood the alpha branch internally. We will open-source it in the near future for use as a demonstration of how to use features like `useSuspenseQuery` and `useBackgroundQuery` in a nontrivial React app. It may also be useful as a bug reproduction template in the future.

Expand Down
1 change: 1 addition & 0 deletions docs/shared/mutation-result.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ A function to trigger the mutation from your UI. You can optionally pass this fu
* `refetchQueries`
* `update`
* `variables`
* `client`

Any option you pass here overrides any existing value for that option that you passed to `useMutation`.

Expand Down
29 changes: 26 additions & 3 deletions docs/source/api/link/introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,9 @@ const additiveLink = from([

### Directional composition

You might want your link chain's execution to branch, depending on the details of the operation being performed. You can define this logic with the `split` method of an `ApolloLink` instance. This method takes three parameters:
You might want your link chain's execution to branch, depending on the details of the operation being performed.

To support this, the `@apollo/client` library provides a `split` function that lets you use one of two different `Link`s, according to the result of a boolean check. You can also use the `split` method of an `ApolloLink` instance.

| Name | Description |
|---|---|
Expand All @@ -239,8 +241,8 @@ import { RetryLink } from '@apollo/client/link/retry';

const directionalLink = new RetryLink().split(
(operation) => operation.getContext().version === 1,
new HttpLink({ uri: "http://localhost:4000/v1/graphql" }),
new HttpLink({ uri: "http://localhost:4000/v2/graphql" })
new HttpLink({ uri: 'http://localhost:4000/v1/graphql' }),
new HttpLink({ uri: 'http://localhost:4000/v2/graphql' })
);
```

Expand All @@ -250,6 +252,27 @@ Other uses for the `split` method include:
* Using different transport methods depending on the operation type (such as HTTP for queries and WebSocket for subscriptions)
* Customizing logic depending on whether a user is logged in

In the following example, all subscription operations are sent to `GraphQLWsLink`, with all other operations sent to `HttpLink`:

```js
import { split, HttpLink } from '@apollo/client';
import { getMainDefinition } from '@apollo/client/utilities';
import { GraphQLWsLink } from '@apollo/client/link/subscriptions';
import { createClient } from 'graphql-ws';

export const link = split(
({ query }) => {
const definition = getMainDefinition(query);
return (
definition.kind === 'OperationDefinition' &&
definition.operation === 'subscription'
);
},
new GraphQLWsLink(createClient({ url: 'ws://localhost:3000/subscriptions' })),
new HttpLink({ uri: 'http://localhost:4000/graphql' })
);
```

### Providing to Apollo Client

After you finish composing your entire link chain, you provide the resulting link to the constructor of `ApolloClient`, like so:
Expand Down
2 changes: 1 addition & 1 deletion docs/source/api/react/hooks-experimental.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Beginning with version `3.7.0`, Apollo Client Web has preview support for the `u

### Using `useFragment_experimental`

> A [GraphQL fragment](http://graphql.org/learn/queries/#fragments) is a piece of logic that can be shared between multiple queries and mutations. [See the API reference.](../../data/fragments)
> A [GraphQL fragment](http://graphql.org/learn/queries/#fragments) defines a subset of fields on a GraphQL type that can be used to specify component-level data dependencies or allow re-use between multiple queries and mutations. [See the API reference.](../../data/fragments)
Given the following fragment definition:

Expand Down
2 changes: 1 addition & 1 deletion docs/source/api/react/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ api_reference: true
import { MockedProvider } from "@apollo/client/testing";
```

The `MockedProvider` component is a mocked version of [`ApolloProvider`](./hooks/#the-apolloprovider-component) that doesn't send network requests to your API. Instead, you to specify the exact response payload for a given GraphQL operation. This enables you to test your application's operations without communicating with a server.
The `MockedProvider` component is a mocked version of [`ApolloProvider`](./hooks/#the-apolloprovider-component) that doesn't send network requests to your API. Instead, it allows you to specify the exact response payload for a given GraphQL operation. This enables you to test your application's operations without communicating with a server.

#### Props

Expand Down
6 changes: 3 additions & 3 deletions docs/source/get-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ npm install @apollo/client graphql

> If you're using a React sandbox from CodeSandbox and you encounter a `TypeError`, try downgrading the version of the `graphql` package to `15.8.0` in the Dependencies panel. If you encounter a _different_ error after downgrading, refresh the page.
Our example application will use the [FlyBy GraphQL API](https://flyby-gateway.herokuapp.com/) from Apollo Odyssey's [Voyage tutorial series](https://www.apollographql.com/tutorials/voyage-part1/). This API provides a list of intergalactic travel locations and details about those locations 👽
Our example application will use the [FlyBy GraphQL API](https://flyby-router-demo.herokuapp.com/) from Apollo Odyssey's [Voyage tutorial series](https://www.apollographql.com/tutorials/voyage-part1/). This API provides a list of intergalactic travel locations and details about those locations 👽

## Step 3: Initialize `ApolloClient`

Expand All @@ -44,7 +44,7 @@ Next we'll initialize `ApolloClient`, passing its constructor a configuration ob

```js title="index.js"
const client = new ApolloClient({
uri: 'https://flyby-gateway.herokuapp.com/',
uri: 'https://flyby-router-demo.herokuapp.com/',
cache: new InMemoryCache(),
});
```
Expand Down Expand Up @@ -94,7 +94,7 @@ import { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';
import App from './App';

const client = new ApolloClient({
uri: 'https://flyby-gateway.herokuapp.com/',
uri: 'https://flyby-router-demo.herokuapp.com/',
cache: new InMemoryCache(),
});

Expand Down
Loading

0 comments on commit 169840f

Please sign in to comment.