Skip to content

Commit 330581e

Browse files
Merge pull request #317 from apollographql/main
Create a new pull request by comparing changes across two branches
2 parents 89df7a5 + bbaa3ef commit 330581e

17 files changed

Lines changed: 354 additions & 77 deletions

File tree

.changeset/rotten-pears-draw.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@apollo/client": patch
3+
---
4+
5+
Refetch should not return partial data with `errorPolicy: none` and `notifyOnNetworkStatusChange: true`.

.changeset/spotty-kings-unite.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@apollo/client": patch
3+
---
4+
5+
Improve context types

.circleci/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: 2
33
jobs:
44
Filesize:
55
docker:
6-
- image: cimg/node:18.12.0
6+
- image: cimg/node:19.4.0
77
steps:
88
- checkout
99
- run: npm version
@@ -12,7 +12,7 @@ jobs:
1212

1313
Lint:
1414
docker:
15-
- image: cimg/node:18.12.0
15+
- image: cimg/node:19.4.0
1616
steps:
1717
- checkout
1818
- run: npm version
@@ -21,7 +21,7 @@ jobs:
2121

2222
Tests:
2323
docker:
24-
- image: cimg/node:18.12.0
24+
- image: cimg/node:19.4.0
2525
steps:
2626
- checkout
2727
- run: npm run ci:precheck

.eslintrc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
{
2+
"parser": "@typescript-eslint/parser",
3+
"plugins": ["@typescript-eslint"],
4+
"env": {
5+
"browser": true,
6+
"node": true,
7+
"es2021": true
8+
},
9+
"parserOptions": {
10+
"ecmaVersion": "latest"
11+
},
212
"overrides": [
313
{
4-
"parser": "@typescript-eslint/parser",
5-
"plugins": ["@typescript-eslint"],
614
"files": ["**/__tests__/**/*.[jt]sx", "**/?(*.)+(test).[jt]sx"],
715
"extends": ["plugin:testing-library/react"],
816
"rules": {

.github/workflows/close-stale-issues.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ jobs:
111111
# only-pr-labels: # optional, default is
112112

113113
# The maximum number of operations per run, used to control rate limiting (GitHub API CRUD related).
114-
operations-per-run: 100 # optional, default is 30
114+
operations-per-run: 500 # optional, default is 30
115115

116116
# Remove stale labels from issues and pull requests when they are updated or commented on.
117117
remove-stale-when-updated: false
@@ -123,7 +123,7 @@ jobs:
123123
remove-pr-stale-when-updated: false
124124

125125
# Run the processor in debug mode without actually performing any operations on live issues.
126-
debug-only: true
126+
debug-only: false
127127

128128
# # The order to get issues or pull requests. Defaults to false, which is descending.
129129
# ascending: # optional, default is false

docs/shared/subscription-options.mdx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
| - | - | - |
33
| `subscription` | DocumentNode | A GraphQL subscription document parsed into an AST by `graphql-tag`. **Optional** for the `useSubscription` Hook since the subscription can be passed in as the first parameter to the Hook. **Required** for the `Subscription` component. |
44
| `variables` | { [key: string]: any } | An object containing all of the variables your subscription needs to execute |
5-
| `shouldResubscribe` | boolean | Determines if your subscription should be unsubscribed and subscribed again |
5+
| `shouldResubscribe` | boolean | Determines if your subscription should be unsubscribed and subscribed again when an input to the hook (such as `subscription` or `variables`) changes. |
66
| `skip` | boolean | Determines if the current subscription should be skipped. Useful if, for example, variables depend on previous queries and are not ready yet. |
7-
| `onSubscriptionData` | **Deprecated.** (options: OnSubscriptionDataOptions<TData>) => any | Allows the registration of a callback function, that will be triggered each time the `useSubscription` Hook / `Subscription` component receives data. The callback `options` object param consists of the current Apollo Client instance in `client`, and the received subscription data in `subscriptionData`. |
8-
| `onData` | (options: OnDataOptions<TData>) => any | Allows the registration of a callback function, that will be triggered each time the `useSubscription` Hook / `Subscription` component receives data. The callback `options` object param consists of the current Apollo Client instance in `client`, and the received subscription data in `data`. |
9-
| `onSubscriptionComplete` | **Deprecated.** () => void | Allows the registration of a callback function, that will be triggered when the `useSubscription` Hook / `Subscription` component completes the subscription. |
10-
| `onComplete` | () => void | Allows the registration of a callback function, that will be triggered each time the `useSubscription` Hook / `Subscription` component completes the subscription. |
7+
| `onSubscriptionData` | **Deprecated.** (options: OnSubscriptionDataOptions<TData>) => any | Allows the registration of a callback function that will be triggered each time the `useSubscription` Hook / `Subscription` component receives data. The callback `options` object param consists of the current Apollo Client instance in `client`, and the received subscription data in `subscriptionData`. |
8+
| `onData` | (options: OnDataOptions<TData>) => any | Allows the registration of a callback function that will be triggered each time the `useSubscription` Hook / `Subscription` component receives data. The callback `options` object param consists of the current Apollo Client instance in `client`, and the received subscription data in `data`. |
9+
| `onError` | (error: ApolloError) => void | Allows the registration of a callback function that will be triggered each time the `useSubscription` Hook / `Subscription` component receives an error. |
10+
| `onSubscriptionComplete` | **Deprecated.** () => void | Allows the registration of a callback function that will be triggered when the `useSubscription` Hook / `Subscription` component completes the subscription. |
11+
| `onComplete` | () => void | Allows the registration of a callback function that will be triggered each time the `useSubscription` Hook / `Subscription` component completes the subscription. |
1112
| `fetchPolicy` | FetchPolicy | How you want your component to interact with the Apollo cache. For details, see [Setting a fetch policy](/react/data/queries/#setting-a-fetch-policy). |
1213
| `context` | Record<string, any> | Shared context between your component and your network interface (Apollo Link). |
1314
| `client` | ApolloClient | An `ApolloClient` instance. By default `useSubscription` / `Subscription` uses the client passed down via context, but a different client can be passed in. |

package-lock.json

Lines changed: 70 additions & 49 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@
4242
"prepdist": "node ./config/prepareDist.js",
4343
"prepdist:changesets": "ts-node-script config/prepareChangesetsRelease.ts",
4444
"postprocess-dist": "ts-node-script config/postprocessDist.ts",
45-
"clean": "rimraf -r dist coverage lib temp",
45+
"clean": "rimraf dist coverage lib temp",
4646
"ci:precheck": "node config/precheck.js",
4747
"lint": "eslint '**/__tests__/**/*.[jt]sx'",
4848
"test": "jest --config ./config/jest.config.js",
4949
"test:debug": "node --inspect-brk node_modules/.bin/jest --config ./config/jest.config.js --runInBand --testTimeout 99999 --logHeapUsage",
5050
"test:ci": "TEST_ENV=ci npm run test:coverage -- --logHeapUsage && npm run test:memory",
5151
"test:watch": "jest --config ./config/jest.config.js --watch",
52-
"test:memory": "cd scripts/memory && npm i && npm test",
52+
"test:memory": "npm i && npm run build && cd scripts/memory && npm i && npm test",
5353
"test:coverage": "npm run coverage -- --ci --runInBand --reporters=default --reporters=jest-junit",
5454
"coverage": "node --no-compilation-cache --expose-gc --max_old_space_size=4096 node_modules/.bin/jest --config ./config/jest.config.js --logHeapUsage --coverage --watchAll=false",
5555
"bundlesize": "npm run build && ts-node-script ./config/bundlesize.ts",
@@ -143,7 +143,7 @@
143143
"react-dom-17": "npm:react-dom@^17",
144144
"recast": "0.22.0",
145145
"resolve": "1.22.1",
146-
"rimraf": "3.0.2",
146+
"rimraf": "4.0.7",
147147
"rollup": "2.79.1",
148148
"rollup-plugin-terser": "7.0.2",
149149
"rxjs": "7.8.0",

scripts/memory/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"name": "apollo-client-memory-tests",
33
"private": true,
44
"scripts": {
5-
"preinstall": "cd ../.. && npm i && npm run build",
65
"test": "mocha --exit -n expose-gc tests.js"
76
},
87
"dependencies": {

src/__tests__/ApolloClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2245,7 +2245,7 @@ describe('ApolloClient', () => {
22452245
query: {kind: Kind.DOCUMENT, definitions: []},
22462246
variables: {foo: 'bar'},
22472247
errorPolicy: 'none',
2248-
context: null,
2248+
context: undefined,
22492249
fetchPolicy: 'cache-first',
22502250
pollInterval: 100,
22512251
notifyOnNetworkStatusChange: true,

0 commit comments

Comments
 (0)