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

Create a new pull request by comparing changes across two branches #202

Merged
merged 11 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .api-reports/api-report-react.md
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,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 @@ -895,6 +895,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_internal.md
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,8 @@ export 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.md
Original file line number Diff line number Diff line change
Expand Up @@ -1328,6 +1328,8 @@ class InternalQueryReference<TData = unknown> {
// (undocumented)
retain(): () => void;
// (undocumented)
softRetain(): () => void;
// (undocumented)
get watchQueryOptions(): WatchQueryOptions<OperationVariables, TData>;
}

Expand Down
5 changes: 5 additions & 0 deletions .changeset/mean-singers-cheer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@apollo/client": patch
---

Bail out of `executeSubSelectedArray` calls if the array has 0 elements.
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
4 changes: 2 additions & 2 deletions .size-limits.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"dist/apollo-client.min.cjs": 39277,
"import { ApolloClient, InMemoryCache, HttpLink } from \"dist/index.js\" (production)": 32630
"dist/apollo-client.min.cjs": 39325,
"import { ApolloClient, InMemoryCache, HttpLink } from \"dist/index.js\" (production)": 32634
}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @apollo/client

## 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
Expand Down
32 changes: 16 additions & 16 deletions integration-tests/package-lock.json

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

Loading
Loading