Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release-3.8' into pr/react-imports
Browse files Browse the repository at this point in the history
  • Loading branch information
phryneas committed Jul 7, 2023
2 parents 1031bf3 + 2ebbd3a commit ed9919d
Show file tree
Hide file tree
Showing 279 changed files with 36,382 additions and 1,315 deletions.
6 changes: 6 additions & 0 deletions .attw.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"ignoreRules": [
"false-esm",
"cjs-resolves-to-esm"
]
}
5 changes: 5 additions & 0 deletions .changeset/cool-dogs-applaud.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@apollo/client': patch
---

Prevents the DevTool installation warning to be turned into a documentation link.
5 changes: 5 additions & 0 deletions .changeset/dry-tools-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@apollo/client': patch
---

Make private fields `inFlightLinkObservables` and `fetchCancelFns` protected in QueryManager in order to make types available in [`@apollo/experimental-nextjs-app-support`](https://www.npmjs.com/package/@apollo/experimental-nextjs-app-support) package when extending the `ApolloClient` class.
6 changes: 6 additions & 0 deletions .changeset/itchy-bulldogs-help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@apollo/client': patch
---

Store React.Context instance mapped by React.createContext instance, not React.version.
Using `React.version` can cause problems with `preact`, as multiple versions of `preact` will all identify themselves as React `17.0.2`.
5 changes: 0 additions & 5 deletions .changeset/khaki-months-rhyme.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/lemon-fans-shake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@apollo/client': minor
---

Add .js file extensions to imports in src and dist/**/*.d.ts
5 changes: 4 additions & 1 deletion .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
"changesets": [
"afraid-zebras-punch",
"cold-tips-accept",
"cool-dogs-applaud",
"curvy-dragons-talk",
"curvy-monkeys-kneel",
"cyan-insects-love",
"cyan-sloths-grin",
"dry-crabs-thank",
"dry-tools-chew",
"dull-snakes-turn",
"early-pens-retire",
"famous-ladybugs-reflect",
Expand All @@ -22,7 +24,6 @@
"heavy-ties-sneeze",
"hungry-chairs-live",
"hungry-eagles-kick",
"khaki-months-rhyme",
"lazy-teachers-sell",
"light-ravens-wait",
"little-schools-roll",
Expand Down Expand Up @@ -51,9 +52,11 @@
"small-tomatoes-explode",
"smooth-clouds-sort",
"smooth-forks-shop",
"sour-weeks-suffer",
"spotty-news-stare",
"strange-drinks-report",
"tasty-wasps-relate",
"ten-cherries-clap",
"twelve-files-promise",
"warm-pandas-cry",
"wild-mice-nail"
Expand Down
9 changes: 9 additions & 0 deletions .changeset/sour-weeks-suffer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@apollo/client': patch
---

Throw errors in `useSuspenseQuery` for errors returned in incremental chunks when `errorPolicy` is `none`. This provides a more consistent behavior of the `errorPolicy` in the hook.

### Potentially breaking change

Previously, if you issued a query with `@defer` and relied on `errorPolicy: 'none'` to set the `error` property returned from `useSuspenseQuery` when the error was returned in an incremental chunk, this error is now thrown. Switch the `errorPolicy` to `all` to avoid throwing the error and instead return it in the `error` property.
5 changes: 5 additions & 0 deletions .changeset/ten-cherries-clap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@apollo/client': patch
---

`useSuspenseQuery` and `useBackgroundQuery` will now properly apply changes to its options between renders.
5 changes: 5 additions & 0 deletions .changeset/three-grapes-marry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@apollo/client': minor
---

Changes how development-only code is bundled in the library to more reliably enable consuming bundlers to reduce production bundle sizes while keeping compatibility with non-node environments.
60 changes: 58 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 2
version: 2.1

jobs:
# Filesize:
Expand Down Expand Up @@ -37,10 +37,66 @@ jobs:
- store_artifacts:
path: reports/junit

BuildTarball:
docker:
- image: cimg/node:20.2.0
steps:
- checkout
- run: npm run ci:precheck
- run: npm version
- run: npm ci
- run: npm run build && cd dist && mv "$(npm pack --json | jq --raw-output '.[0].filename')" apollo-client.tgz
- persist_to_workspace:
root: dist
paths:
- apollo-client.tgz

IntegrationTests:
parameters:
framework:
type: string
docker:
- image: cimg/node:18.16.1
steps:
- checkout
- attach_workspace:
at: /tmp/workspace
- run: npm version
- run:
command: npm install @apollo/client@/tmp/workspace/apollo-client.tgz --workspace=<< parameters.framework >>
working_directory: integration-tests
- run:
command: npx playwright install-deps
working_directory: integration-tests
- run:
command: npm run ci-preparations --workspace=<< parameters.framework >> --if-present
working_directory: integration-tests
- run:
command: npm run build --workspace=<< parameters.framework >> --if-present
working_directory: integration-tests
- run:
command: npm run test --workspace=<< parameters.framework >>
working_directory: integration-tests

workflows:
version: 2
Build and Test:
jobs:
# - Filesize
- Tests
- Lint
- BuildTarball
- IntegrationTests:
name: Integration Test << matrix.framework >>
requires:
- BuildTarball
matrix:
parameters:
framework:
- cra4
- cra5
- next
- dual-module-test-esm
- dual-module-test-standard
- vite
- vite-swc
# -browser-esm would need a package publish to npm/CDNs
23 changes: 22 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"plugins": ["@typescript-eslint", "import"],
"env": {
"browser": true,
"node": true,
Expand All @@ -9,6 +9,16 @@
"parserOptions": {
"ecmaVersion": "latest"
},
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},
"import/resolver": {
"typescript": {
"alwaysTryTypes": true
}
}
},
"overrides": [
{
"files": ["**/*.ts", "**/*.tsx"],
Expand All @@ -26,6 +36,14 @@
"selector": "ImportDeclaration[source.value='react'][importKind!='type'] :matches(ImportSpecifier, ImportDefaultSpecifier)",
"message": "Please only use the namespace import syntax (`import * as React from 'react'`) for React imports!"
}
],
"import/extensions": [
"error",
"always",
{
"ignorePackages": true,
"checkTypeImports": true
}
]
}
},
Expand All @@ -38,4 +56,7 @@
}
}
],
"rules": {
"import/no-unresolved": "error"
}
}
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ body:
- type: input
attributes:
label: Link to Reproduction
description: A link with runnable reproduction. For web projects, you can fork our `react-apollo-error-template` to create one via [GitHub repository](https://github.com/apollographql/react-apollo-error-template) or [CodeSandbox](https://codesandbox.io/s/github/apollographql/react-apollo-error-template). For React Native projects, you can fork our `rn-apollo-client-testbed` via [GitHub respository](https://github.com/apollographql/rn-apollo-client-testbed). Make sure this includes everything necessary (`package.json`, `tsconfig.json`, etc.) so we don't have to guess anything!
description: "A link with runnable reproduction. For web projects, you can fork our `react-apollo-error-template` to create one via [GitHub repository](https://github.com/apollographql/react-apollo-error-template) or [CodeSandbox](https://codesandbox.io/s/github/apollographql/react-apollo-error-template). For React Native projects, you can fork our `rn-apollo-client-testbed` via [GitHub respository](https://github.com/apollographql/rn-apollo-client-testbed). Make sure this includes everything necessary (`package.json`, `tsconfig.json`, etc.) so we don't have to guess anything! If a minimal reproduction can't be created, please share a [Replay](https://docs.replay.io/workflows/recording-bug-reports) of the bug (note: you don't have to grant Replay access to a private repo to create a recording, but it will contain source maps for your JavaScript code)."
validations:
required: true
- type: textarea
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/arethetypeswrong.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: AreTheTypesWrong
on:
pull_request:
branches:
- main
- release-*

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
arethetypeswrong:
name: Are the types wrong
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Install dependencies (with cache)
uses: bahmutov/npm-install@v1

- name: Run build
run: npm run build
- name: Run AreTheTypesWrong
id: attw
run: ./node_modules/.bin/attw --format ascii --pack dist > $GITHUB_STEP_SUMMARY
31 changes: 31 additions & 0 deletions .github/workflows/compare-build-output.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Compare Build Output
on:
pull_request:
branches:
- main
- release-*

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
comparebuildoutput:
name: Compare Build Output
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
# Fetch entire git history so we have the parent commit to compare against
fetch-depth: 0
- name: Setup Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Install dependencies (with cache)
uses: bahmutov/npm-install@v1

- name: Run comparison script
id: attw
run: ./config/compare-build-output-to.sh $(git merge-base HEAD origin/${{ github.base_ref }}) > $GITHUB_STEP_SUMMARY
env:
RUNNER_TEMP: ${{ runner.temp }}
1 change: 1 addition & 0 deletions .github/workflows/size-limit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
branches:
- main
- release-*
- pr/*
jobs:
size:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,6 @@ junit.xml
reports

esbuild-why-*.html

.yalc
yalc.lock
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
config/*
!config/processInvariants.ts

!integration-tests/
!integration-tests/**

##### PATHS TO BE FORMATTED #####
!src/
src/*
Expand Down
15 changes: 12 additions & 3 deletions .size-limit.cjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const checks = [
{
path: "dist/apollo-client.min.cjs",
limit: "37789"
limit: "37860"
},
{
path: "dist/main.cjs",
Expand All @@ -10,7 +10,7 @@ const checks = [
{
path: "dist/index.js",
import: "{ ApolloClient, InMemoryCache, HttpLink }",
limit: "33371"
limit: "32181"
},
...[
"ApolloProvider",
Expand Down Expand Up @@ -44,6 +44,15 @@ const checks = [
"tslib",
"zen-observable-ts"
],
}));
})).flatMap((value) => value.path == "dist/apollo-client.min.cjs" ? value : [{...value, limit: undefined}, {
...value,
name: `${value.name} (production)`,
modifyEsbuildConfig(config){
config.define = {
"globalThis.__DEV__": `false`,
}
return config
}
}]);

module.exports = checks;
24 changes: 22 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
# @apollo/client

## 3.8.0-beta.5
## 3.8.0-beta.6

### Patch Changes

- [#10631](https://github.com/apollographql/apollo-client/pull/10631) [`b93388d75`](https://github.com/apollographql/apollo-client/commit/b93388d7582d88859c4975dff524c1ceb5bd2b4e) Thanks [@phryneas](https://github.com/phryneas)! - ObservableQuery.getCurrentResult: skip the cache if the running query should not access the cache
- [#11027](https://github.com/apollographql/apollo-client/pull/11027) [`e47cfd04e`](https://github.com/apollographql/apollo-client/commit/e47cfd04ec50cb4c19828f4d655eb0f989cdcf7d) Thanks [@phryneas](https://github.com/phryneas)! - Prevents the DevTool installation warning to be turned into a documentation link.

- [#11013](https://github.com/apollographql/apollo-client/pull/11013) [`5ed2cfdaf`](https://github.com/apollographql/apollo-client/commit/5ed2cfdaf9030550d4c82200a5a690b112ad3335) Thanks [@alessbell](https://github.com/alessbell)! - Make private fields `inFlightLinkObservables` and `fetchCancelFns` protected in QueryManager in order to make types available in [`@apollo/experimental-nextjs-app-support`](https://www.npmjs.com/package/@apollo/experimental-nextjs-app-support) package when extending the `ApolloClient` class.

- [#11032](https://github.com/apollographql/apollo-client/pull/11032) [`6a4da900a`](https://github.com/apollographql/apollo-client/commit/6a4da900a1bc5da3524caabd64bb30945e66f675) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Throw errors in `useSuspenseQuery` for errors returned in incremental chunks when `errorPolicy` is `none`. This provides a more consistent behavior of the `errorPolicy` in the hook.

### Potentially breaking change

Previously, if you issued a query with `@defer` and relied on `errorPolicy: 'none'` to set the `error` property returned from `useSuspenseQuery` when the error was returned in an incremental chunk, this error is now thrown. Switch the `errorPolicy` to `all` to avoid throwing the error and instead return it in the `error` property.

- [#11025](https://github.com/apollographql/apollo-client/pull/11025) [`6092b6edf`](https://github.com/apollographql/apollo-client/commit/6092b6edf67ef311954c18c778ed0bdca1b77258) Thanks [@jerelmiller](https://github.com/jerelmiller)! - `useSuspenseQuery` and `useBackgroundQuery` will now properly apply changes to its options between renders.

## 3.8.0-beta.5

### Patch Changes

- [#10999](https://github.com/apollographql/apollo-client/pull/10999) [`c1904a78a`](https://github.com/apollographql/apollo-client/commit/c1904a78abb186f475303d632c2cb303bbd8d4f9) Thanks [@phryneas](https://github.com/phryneas)! - Fix a bug in `QueryReference` where `this.resolve` or `this.reject` might be executed even if `undefined`.

Expand Down Expand Up @@ -276,6 +290,12 @@
- [#10340](https://github.com/apollographql/apollo-client/pull/10340) [`4f73c5ca1`](https://github.com/apollographql/apollo-client/commit/4f73c5ca15d367aa23f02018d062f221c4506a4d) Thanks [@alessbell](https://github.com/alessbell)! - Avoid calling `useQuery` `onCompleted` for cache writes
## 3.7.17
### Patch Changes
- [#10631](https://github.com/apollographql/apollo-client/pull/10631) [`b93388d75`](https://github.com/apollographql/apollo-client/commit/b93388d7582d88859c4975dff524c1ceb5bd2b4e) Thanks [@phryneas](https://github.com/phryneas)! - ObservableQuery.getCurrentResult: skip the cache if the running query should not access the cache
## 3.7.16
### Patch Changes
Expand Down
Loading

0 comments on commit ed9919d

Please sign in to comment.