Skip to content

Commit

Permalink
Merge branch 'release-3.8' into pr/global-ApolloContext
Browse files Browse the repository at this point in the history
  • Loading branch information
phryneas committed May 16, 2023
2 parents a04c8e7 + ba1d061 commit 2446ace
Show file tree
Hide file tree
Showing 141 changed files with 5,114 additions and 1,079 deletions.
5 changes: 5 additions & 0 deletions .changeset/forty-zebras-smash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@apollo/client": patch
---

Fix a bug where other fields could be aliased to `__typename` or `id`, in which case an incoming result would be merged into the wrong cache entry.
5 changes: 5 additions & 0 deletions .changeset/light-ravens-wait.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@apollo/client': patch
---

Chore: Add ESLint rule for consistent type imports, apply autofix
5 changes: 5 additions & 0 deletions .changeset/seven-onions-burn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@apollo/client': minor
---

Feature: adds `useBackgroundQuery` and `useReadQuery` hooks
5 changes: 5 additions & 0 deletions .changeset/short-feet-relax.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@apollo/client': patch
---

Change an import in `useQuery` and `useMutation` that added an unnecessary runtime dependency on `@apollo/client/core`. This drastically reduces the bundle size of each the hooks.
5 changes: 5 additions & 0 deletions .changeset/short-monkeys-love.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@apollo/client': patch
---

Remove the deprecated `returnPartialData` option from `useFragment` hook.
7 changes: 7 additions & 0 deletions .changeset/silent-eagles-check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@apollo/client': minor
---

Introduce the new `removeTypenameFromVariables` link. This link will automatically remove `__typename` fields from `variables` for all operations. This link can be configured to exclude JSON-scalars for scalars that utilize `__typename`.

This change undoes some work from #10724 where `__typename` was automatically stripped for all operations with no configuration. This was determined to be a breaking change and therefore moved into this link.
18 changes: 9 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
version: 2

jobs:
Filesize:
docker:
- image: cimg/node:20.1.0
steps:
- checkout
- run: npm version
- run: npm ci
- run: npm run bundlesize
# Filesize:
# docker:
# - image: cimg/node:20.1.0
# steps:
# - checkout
# - run: npm version
# - run: npm ci
# - run: npm run bundlesize

Lint:
docker:
Expand Down Expand Up @@ -41,6 +41,6 @@ workflows:
version: 2
Build and Test:
jobs:
- Filesize
# - Filesize
- Tests
- Lint
14 changes: 13 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@
"ecmaVersion": "latest"
},
"overrides": [
{
"files": ["**/*.ts", "**/*.tsx"],
"excludedFiles": ["**/__tests__/**/*.*"],
"rules": {
"@typescript-eslint/consistent-type-imports": ["error", {
"prefer": "type-imports",
"disallowTypeAnnotations": false,
"fixStyle": "separate-type-imports"
}],
"@typescript-eslint/no-import-type-side-effects": "error"
}
},
{
"files": ["**/__tests__/**/*.[jt]sx", "**/?(*.)+(test).[jt]sx"],
"extends": ["plugin:testing-library/react"],
Expand All @@ -18,5 +30,5 @@
"testing-library/no-wait-for-multiple-assertions": "off"
}
}
]
],
}
22 changes: 22 additions & 0 deletions .github/workflows/size-limit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "size"
on:
pull_request:
branches:
- main
- release-*
jobs:
size:
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 size-limit
uses: andresz1/size-limit-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/snapshot-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:

- name: Add comment if no new changesets exist
if: ${{ steps.added-files.outputs.changesets == '' }}
uses: peter-evans/create-or-update-comment@v2.1.0
uses: peter-evans/create-or-update-comment@v3.0.1
with:
issue-number: ${{ github.event.issue.number }}
body: |
Expand All @@ -106,7 +106,7 @@ jobs:

- name: Create comment
if: ${{ steps.added-files.outputs.changesets != '' }}
uses: peter-evans/create-or-update-comment@v3.0.0
uses: peter-evans/create-or-update-comment@v3.0.1
with:
issue-number: ${{ github.event.issue.number }}
body: |
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,5 @@ junit.xml

# Ignore generated test report output
reports

esbuild-why-*.html
7 changes: 7 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,21 @@ src/utilities/common/__tests__/*
!src/utilities/common/__tests__/omitDeep.ts
!src/utilities/common/__tests__/stripTypename.ts

# Allowed links
!src/link
src/link/*
!src/link/remove-typename

## Allowed React Hooks
!src/react/hooks/
src/react/hooks/*
!src/react/hooks/internal
!src/react/hooks/useSuspenseCache.ts
!src/react/hooks/useSuspenseQuery.ts
!src/react/hooks/useBackgroundQuery.ts

## Allowed React hook tests
!src/react/hooks/__tests__/
src/react/hooks/__tests__/*
!src/react/hooks/__tests__/useSuspenseQuery.test.tsx
!src/react/hooks/__tests__/useBackgroundQuery.test.tsx
49 changes: 49 additions & 0 deletions .size-limit.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
const checks = [
{
path: "dist/apollo-client.min.cjs",
limit: "36.84kb"
},
{
path: "dist/main.cjs",
import: "{ ApolloClient, InMemoryCache, HttpLink }"
},
{
path: "dist/index.js",
import: "{ ApolloClient, InMemoryCache, HttpLink }",
limit: "35.02kb"
},
...[
"ApolloProvider",
"useQuery",
"useLazyQuery",
"useMutation",
"useSubscription",
"useSuspenseQuery_experimental",
"useBackgroundQuery_experimental",
"useReadQuery_experimental",
"useFragment_experimental"
].map((name) => ({ path: "dist/react/index.js", import: `{ ${name} }` })),
].map((config) => ({
...config,
name: config.name || config.import ? `import ${config.import} from "${config.path}"` : config.path,
ignore: [
...(config.ignore || []),
"react",
"react-dom",
"@graphql-typed-document-node/core",
"@wry/context",
"@wry/equality",
"@wry/trie",
"graphql-tag",
"hoist-non-react-statics",
"optimism",
"prop-types",
"response-iterator",
"symbol-observable",
"ts-invariant",
"tslib",
"zen-observable-ts"
],
}));

module.exports = checks;
2 changes: 1 addition & 1 deletion config/bundlesize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { join } from "path";
import { gzipSync } from "zlib";
import bytes from "bytes";

const gzipBundleByteLengthLimit = bytes("35.06KB");
const gzipBundleByteLengthLimit = bytes("35.25KB");
const minFile = join("dist", "apollo-client.min.cjs");
const minPath = join(__dirname, "..", minFile);
const gzipByteLen = gzipSync(readFileSync(minPath)).byteLength;
Expand Down
1 change: 1 addition & 0 deletions config/entryPoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const entryPoints = [
{ dirs: ['link', 'http'] },
{ dirs: ['link', 'persisted-queries'] },
{ dirs: ['link', 'retry'] },
{ dirs: ['link', 'remove-typename'] },
{ dirs: ['link', 'schema'] },
{ dirs: ['link', 'subscriptions'] },
{ dirs: ['link', 'utils'] },
Expand Down
3 changes: 2 additions & 1 deletion config/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ const react17TestFileIgnoreList = [
ignoreTSFiles,
// For now, we only support useSuspenseQuery with React 18, so no need to test
// it with React 17
'src/react/hooks/__tests__/useSuspenseQuery.test.tsx'
'src/react/hooks/__tests__/useSuspenseQuery.test.tsx',
'src/react/hooks/__tests__/useBackgroundQuery.test.tsx'
]

const tsStandardConfig = {
Expand Down

0 comments on commit 2446ace

Please sign in to comment.