Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into release-3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller committed Apr 1, 2024
2 parents b9b4263 + e8556c3 commit fedea97
Show file tree
Hide file tree
Showing 26 changed files with 1,469 additions and 209 deletions.
2 changes: 2 additions & 0 deletions .api-reports/api-report-react.md
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,8 @@ class InternalQueryReference<TData = unknown> {
// (undocumented)
retain(): () => void;
// (undocumented)
softRetain(): () => void;
// (undocumented)
get watchQueryOptions(): WatchQueryOptions<OperationVariables, TData>;
}

Expand Down
2 changes: 2 additions & 0 deletions .api-reports/api-report-react_hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,8 @@ class InternalQueryReference<TData = unknown> {
// (undocumented)
retain(): () => void;
// (undocumented)
softRetain(): () => void;
// (undocumented)
get watchQueryOptions(): WatchQueryOptions<OperationVariables, TData>;
}

Expand Down
4 changes: 4 additions & 0 deletions .api-reports/api-report-react_internal.md
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,8 @@ export class InternalQueryReference<TData = unknown> {
// (undocumented)
retain(): () => void;
// (undocumented)
softRetain(): () => void;
// (undocumented)
get watchQueryOptions(): WatchQueryOptions<OperationVariables, TData>;
}

Expand Down Expand Up @@ -1733,6 +1735,8 @@ interface SubscriptionOptions<TVariables = OperationVariables, TData = any> {
class SuspenseCache {
constructor(options?: SuspenseCacheOptions);
// (undocumented)
add(cacheKey: CacheKey, queryRef: InternalQueryReference<unknown>): void;
// (undocumented)
getQueryRef<TData = any>(cacheKey: CacheKey, createObservable: () => ObservableQuery<TData>): InternalQueryReference<TData>;
}

Expand Down
2 changes: 2 additions & 0 deletions .api-reports/api-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -1332,6 +1332,8 @@ class InternalQueryReference<TData = unknown> {
// (undocumented)
retain(): () => void;
// (undocumented)
softRetain(): () => void;
// (undocumented)
get watchQueryOptions(): WatchQueryOptions<OperationVariables, TData>;
}

Expand Down
5 changes: 0 additions & 5 deletions .changeset/eleven-doors-rescue.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/flat-singers-kiss.md

This file was deleted.

12 changes: 6 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

Lint:
docker:
- image: cimg/node:21.6.2
- image: cimg/node:21.7.1
steps:
- checkout
- run: npm version
Expand All @@ -24,15 +24,15 @@ jobs:

Formatting:
docker:
- image: cimg/node:21.6.2
- image: cimg/node:21.7.1
steps:
- checkout
- run: npm ci
- run: npm run check:format

Tests:
docker:
- image: cimg/node:21.6.2
- image: cimg/node:21.7.1
steps:
- checkout
- run: npm run ci:precheck
Expand All @@ -50,7 +50,7 @@ jobs:

BuildTarball:
docker:
- image: cimg/node:21.6.2
- image: cimg/node:21.7.1
steps:
- checkout
- run: npm run ci:precheck
Expand All @@ -67,7 +67,7 @@ jobs:
framework:
type: string
docker:
- image: cimg/node:21.6.2
- image: cimg/node:21.7.1
steps:
- checkout
- attach_workspace:
Expand All @@ -94,7 +94,7 @@ jobs:
externalPackage:
type: string
docker:
- image: cimg/node:21.6.2
- image: cimg/node:21.7.1
steps:
- checkout
- attach_workspace:
Expand Down
69 changes: 69 additions & 0 deletions .github/workflows/change-prerelease-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Change Prerelease Tag

on:
workflow_dispatch:
inputs:
branch:
description: "Branch name"
type: string
default: "release-"
required: true
tag:
description: "New tag name"
type: string
default: "rc"
required: true

jobs:
change_prerelease_tag:
name: Changesets Update Prerelease Tag
runs-on: ubuntu-latest
# Allow GITHUB_TOKEN to have write permissions
permissions:
contents: write

steps:
- uses: actions/create-github-app-token@v1
id: github-actions-bot-app-token
with:
app-id: 819772
private-key: ${{ secrets.APOLLO_GITHUB_ACTIONS_BOT_PRIVATE_KEY }}

# Check out the repository, using the Github Actions Bot app's token so
# that we can push later.
- name: Checkout repo
uses: actions/checkout@v4
with:
token: ${{ steps.github-actions-bot-app-token.outputs.token }}
# Checkout release branch entered when workflow was kicked off
ref: ${{ github.event.inputs.branch }}
# Fetch entire git history so Changesets can generate changelogs
# with the correct commits
fetch-depth: 0

- name: Setup Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x

- name: Write latest version to package.json and package-lock.json
run: |
version=$(npm show @apollo/client version)
npm pkg set version="$version"
npm i
- name: Update prerelease tag in .changeset/pre.json
uses: restackio/[email protected]
with:
file: .changeset/pre.json
fields: '{"tag": "${{github.event.inputs.tag}}"}'

- name: Commit and push changes
env:
TAG: ${{ github.event.inputs.tag }}
run: |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git add -A
git commit -m "Prepare for "$TAG" release"
git push
42 changes: 21 additions & 21 deletions .github/workflows/exit-prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,18 @@ jobs:
contents: write

steps:
- uses: actions/create-github-app-token@v1
id: github-actions-bot-app-token
with:
app-id: 819772
private-key: ${{ secrets.APOLLO_GITHUB_ACTIONS_BOT_PRIVATE_KEY }}

# Check out the repository, using the Github Actions Bot app's token so
# that we can push later.
- name: Checkout repo
uses: actions/checkout@v4
with:
token: ${{ steps.github-actions-bot-app-token.outputs.token }}
# Checkout release branch entered when workflow was kicked off
ref: ${{ github.event.inputs.branch }}
# Fetch entire git history so Changesets can generate changelogs
Expand All @@ -32,28 +41,19 @@ jobs:
with:
node-version: 20.x

- name: Get latest tagged version
id: previoustag
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@5
id: formatversion
with:
source: ${{ steps.previoustag.outputs.tag }}
find: "v"
replace: ""

- name: Write previous version to package.json
uses: jaywcjlove/[email protected]
with:
version: ${{ steps.formatversion.outputs.value }}
- name: Write latest version to package.json and package-lock.json
run: |
version=$(npm show @apollo/client version)
npm pkg set version="$version"
npm i
- name: Remove pre.json
run: npx rimraf .changeset/pre.json

- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Exit prerelease mode
# Commit these changes to the branch workflow is running against
branch: ${{ github.event.inputs.branch }}
- name: Commit and push changes
run: |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git add -A
git commit -m "Exit prerelease mode"
git push
42 changes: 36 additions & 6 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,18 @@ jobs:
pull-requests: write
id-token: write
steps:
- uses: actions/create-github-app-token@v1
id: github-actions-bot-app-token
with:
app-id: 819772
private-key: ${{ secrets.APOLLO_GITHUB_ACTIONS_BOT_PRIVATE_KEY }}

# Check out the repository, using the Github Actions Bot app's token so
# that we can push later.
- name: Checkout repo
uses: actions/checkout@v4
with:
token: ${{ steps.github-actions-bot-app-token.outputs.token }}
# Fetch entire git history so Changesets can generate changelogs
# with the correct commits
fetch-depth: 0
Expand Down Expand Up @@ -56,12 +65,33 @@ jobs:
# If .changeset/pre.json does not exist and we did not recently exit
# prerelease mode, enter prerelease mode with tag alpha
if: steps.check_files.outputs.files_exists == 'false' && !contains(github.event.head_commit.message, 'Exit prerelease')
run: npx changeset pre enter alpha
run: |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
npx changeset pre enter alpha
git add -A
git commit -m 'Enter prerelease mode'
git push
- name: Get prerelease changesets
id: prerelease-changesets
uses: notiz-dev/github-action-json-property@release
with:
path: ".changeset/pre.json"
prop_path: "changesets"

- name: Get changesets array length
id: number-of-changesets
run: |
arrayLength=$(echo '${{steps.prerelease-changesets.outputs.prop}}' | jq '. | length')
echo "length=$arrayLength" >> "$GITHUB_OUTPUT"
- name: Create prerelease PR
# If .changeset/pre.json exists and we are not currently cutting a
# release after merging a Version Packages PR
if: steps.check_files.outputs.files_exists == 'true' && !startsWith(github.event.head_commit.message, 'Version Packages')
# Only attempt to create a PR if:
# 1. .changeset/pre.json exists
# 2. we are not actively publishing after merging a Version Packages PR
# 3. AND we have prerelease changesets to publish (otherwise it errors)
if: steps.check_files.outputs.files_exists == 'true' && !startsWith(github.event.head_commit.message, 'Version Packages') && steps.number-of-changesets.outputs.length > 0
uses: changesets/action@v1
with:
version: npm run changeset-version
Expand All @@ -70,8 +100,8 @@ jobs:

- name: Publish to npm + GitHub
id: changesets
# Only run publish if we're still in pre mode and the last commit was
# via an automatically created Version Packages PR
# Only publish if we're still in pre mode and the last commit was
# from an automatically created Version Packages PR
if: steps.check_files.outputs.files_exists == 'true' && startsWith(github.event.head_commit.message, 'Version Packages')
uses: changesets/action@v1
with:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/snapshot-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ jobs:
- name: Detect new changesets
id: added-files
run: |
echo "changesets=$(git diff --name-only --diff-filter=A ${{ steps.comment-branch.outputs.base_sha }} ${{ steps.comment-branch.outputs.head_sha }} .changeset/*.md)" >> "$GITHUB_OUTPUT"
delimiter="$(openssl rand -hex 8)"
echo "changesets<<${delimiter}" >> "${GITHUB_OUTPUT}"
echo "$(git diff --name-only --diff-filter=A ${{ steps.comment-branch.outputs.base_sha }} ${{ steps.comment-branch.outputs.head_sha }} .changeset/*.md)" >> "${GITHUB_OUTPUT}"
echo "${delimiter}" >> "${GITHUB_OUTPUT}"
- name: Append NPM token to .npmrc
run: |
Expand Down
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,34 @@

- [#11465](https://github.com/apollographql/apollo-client/pull/11465) [`7623da7`](https://github.com/apollographql/apollo-client/commit/7623da7720855b0c19e13ff9124679f426a39725) Thanks [@alessbell](https://github.com/alessbell)! - Add `watchFragment` method to the cache and expose it on ApolloClient, refactor `useFragment` using `watchFragment`.

## 3.9.10

### Patch Changes

- [#11738](https://github.com/apollographql/apollo-client/pull/11738) [`b1a5eb8`](https://github.com/apollographql/apollo-client/commit/b1a5eb80cae8bdf2e9d8627f1eab65e088c43438) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an issue where rerendering `useBackgroundQuery` after the `queryRef` had been disposed, either via the auto dispose timeout or by unmounting `useReadQuery`, would cause the `queryRef` to be recreated potentially resulting in another network request.

- [#11738](https://github.com/apollographql/apollo-client/pull/11738) [`b1a5eb8`](https://github.com/apollographql/apollo-client/commit/b1a5eb80cae8bdf2e9d8627f1eab65e088c43438) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Allow queryRefs to be disposed of synchronously when a suspense hook unmounts. This prevents some situations where using a suspense hook with the same query/variables as the disposed queryRef accidentally used the disposed queryRef rather than creating a new instance.

- [#11670](https://github.com/apollographql/apollo-client/pull/11670) [`cc5c03b`](https://github.com/apollographql/apollo-client/commit/cc5c03b2690f452483d83eecb68611a23055d99e) Thanks [@phryneas](https://github.com/phryneas)! - Bail out of `executeSubSelectedArray` calls if the array has 0 elements.

## 3.9.9

### Patch Changes

- [#11696](https://github.com/apollographql/apollo-client/pull/11696) [`466ef82`](https://github.com/apollographql/apollo-client/commit/466ef82198486fc696da64d17d82b46140760ac4) Thanks [@PiR1](https://github.com/PiR1)! - Immediately dispose of the `queryRef` if `useBackgroundQuery` unmounts before the auto dispose timeout kicks in.

## 3.9.8

### Patch Changes

- [#11706](https://github.com/apollographql/apollo-client/pull/11706) [`8619bc7`](https://github.com/apollographql/apollo-client/commit/8619bc7e569c1c732afa6faf605c83a6ce0cdf0c) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix issue in all suspense hooks where returning an empty array after calling `fetchMore` would rerender the component with an empty list.

- [#11694](https://github.com/apollographql/apollo-client/pull/11694) [`835d5f3`](https://github.com/apollographql/apollo-client/commit/835d5f30c532c432e2434561580e6f1ec44cc908) Thanks [@phryneas](https://github.com/phryneas)! - Expose `setErrorMessageHandler` from `@apollo/client/dev` entrypoint.

- [#11689](https://github.com/apollographql/apollo-client/pull/11689) [`cb8ffe5`](https://github.com/apollographql/apollo-client/commit/cb8ffe50e903397f741b62a44624bfe69b5f7b75) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix issue where passing a new `from` option to `useFragment` would first render with the previous value before rerendering with the correct value.

- [#11713](https://github.com/apollographql/apollo-client/pull/11713) [`642092c`](https://github.com/apollographql/apollo-client/commit/642092c713199093aede45f105a1ee3f637614cd) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix issue where setting a default `watchQuery` option in the `ApolloClient` constructor could break `startTransition` when used with suspense hooks.

## 3.9.7

### Patch Changes
Expand Down
Loading

0 comments on commit fedea97

Please sign in to comment.