@apollo/client 4.0.0-alpha.14 → 4.0.0-alpha.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.changeset/beige-spiders-hope.md +5 -0
- package/.changeset/poor-spiders-hunt.md +23 -0
- package/.changeset/pre.json +7 -0
- package/.changeset/selfish-spoons-approve.md +44 -0
- package/.changeset/slimy-ants-bake.md +5 -0
- package/.changeset/sour-colts-tell.md +5 -0
- package/.changeset/sour-guests-poke.md +5 -0
- package/.changeset/strange-walls-march.md +5 -0
- package/CHANGELOG.md +79 -0
- package/__cjs/core/ObservableQuery.cjs +6 -0
- package/__cjs/core/ObservableQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useQuery.cjs +10 -25
- package/__cjs/react/hooks/useQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useQuery.d.cts +0 -1
- package/__cjs/react/ssr/useSSRQuery.cjs +11 -2
- package/__cjs/react/ssr/useSSRQuery.cjs.map +1 -1
- package/__cjs/testing/core/mocking/mockLink.cjs +0 -6
- package/__cjs/testing/core/mocking/mockLink.cjs.map +1 -1
- package/__cjs/testing/core/mocking/mockLink.d.cts +19 -20
- package/__cjs/testing/core/mocking/mockSubscriptionLink.cjs +0 -4
- package/__cjs/testing/core/mocking/mockSubscriptionLink.cjs.map +1 -1
- package/__cjs/testing/core/mocking/mockSubscriptionLink.d.cts +7 -6
- package/__cjs/testing/core/types/deprecated.cjs +3 -0
- package/__cjs/testing/core/types/deprecated.cjs.map +1 -0
- package/__cjs/testing/core/types/deprecated.d.cts +10 -0
- package/__cjs/testing/index.cjs +6 -13
- package/__cjs/testing/index.cjs.map +1 -1
- package/__cjs/testing/index.d.cts +3 -2
- package/__cjs/testing/internal/index.cjs +3 -1
- package/__cjs/testing/internal/index.cjs.map +1 -1
- package/__cjs/testing/internal/index.d.cts +1 -0
- package/__cjs/testing/internal/scenarios/index.cjs +4 -4
- package/__cjs/testing/internal/scenarios/index.cjs.map +1 -1
- package/__cjs/testing/internal/scenarios/index.d.cts +8 -8
- package/__cjs/testing/{core → internal}/wait.cjs +0 -4
- package/__cjs/testing/internal/wait.cjs.map +1 -0
- package/__cjs/testing/{core → internal}/wait.d.cts +0 -1
- package/__cjs/testing/react/MockedProvider.cjs +2 -2
- package/__cjs/testing/react/MockedProvider.cjs.map +1 -1
- package/__cjs/testing/react/MockedProvider.d.cts +2 -3
- package/__cjs/version.cjs +1 -1
- package/core/ObservableQuery.js +6 -0
- package/core/ObservableQuery.js.map +1 -1
- package/package.json +1 -159
- package/react/hooks/useQuery.d.ts +0 -1
- package/react/hooks/useQuery.js +10 -25
- package/react/hooks/useQuery.js.map +1 -1
- package/react/ssr/useSSRQuery.js +11 -2
- package/react/ssr/useSSRQuery.js.map +1 -1
- package/testing/core/mocking/mockLink.d.ts +19 -20
- package/testing/core/mocking/mockLink.js +0 -5
- package/testing/core/mocking/mockLink.js.map +1 -1
- package/testing/core/mocking/mockSubscriptionLink.d.ts +7 -6
- package/testing/core/mocking/mockSubscriptionLink.js +0 -3
- package/testing/core/mocking/mockSubscriptionLink.js.map +1 -1
- package/testing/core/types/deprecated.d.ts +10 -0
- package/testing/core/types/deprecated.js +2 -0
- package/testing/core/types/deprecated.js.map +1 -0
- package/testing/index.d.ts +3 -2
- package/testing/index.js +2 -1
- package/testing/index.js.map +1 -1
- package/testing/internal/index.d.ts +1 -0
- package/testing/internal/index.js +2 -1
- package/testing/internal/index.js.map +1 -1
- package/testing/internal/scenarios/index.d.ts +8 -8
- package/testing/internal/scenarios/index.js +4 -4
- package/testing/internal/scenarios/index.js.map +1 -1
- package/testing/{core → internal}/wait.d.ts +0 -1
- package/testing/{core → internal}/wait.js +0 -3
- package/testing/internal/wait.js.map +1 -0
- package/testing/react/MockedProvider.d.ts +2 -3
- package/testing/react/MockedProvider.js +1 -1
- package/testing/react/MockedProvider.js.map +1 -1
- package/version.js +1 -1
- package/__cjs/testing/core/index.cjs +0 -20
- package/__cjs/testing/core/index.cjs.map +0 -1
- package/__cjs/testing/core/index.d.cts +0 -7
- package/__cjs/testing/core/mocking/mockClient.cjs +0 -17
- package/__cjs/testing/core/mocking/mockClient.cjs.map +0 -1
- package/__cjs/testing/core/mocking/mockClient.d.cts +0 -4
- package/__cjs/testing/core/wait.cjs.map +0 -1
- package/__cjs/testing/core/withConsoleSpy.cjs +0 -33
- package/__cjs/testing/core/withConsoleSpy.cjs.map +0 -1
- package/__cjs/testing/core/withConsoleSpy.d.cts +0 -7
- package/legacyEntryPoints/testing/core/core.cjs +0 -1
- package/legacyEntryPoints/testing/core/core.d.cts +0 -1
- package/legacyEntryPoints/testing/core/index.d.ts +0 -1
- package/legacyEntryPoints/testing/core/index.js +0 -1
- package/testing/core/index.d.ts +0 -7
- package/testing/core/index.js +0 -6
- package/testing/core/index.js.map +0 -1
- package/testing/core/mocking/mockClient.d.ts +0 -4
- package/testing/core/mocking/mockClient.js +0 -14
- package/testing/core/mocking/mockClient.js.map +0 -1
- package/testing/core/wait.js.map +0 -1
- package/testing/core/withConsoleSpy.d.ts +0 -7
- package/testing/core/withConsoleSpy.js +0 -28
- package/testing/core/withConsoleSpy.js.map +0 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
"@apollo/client": minor
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Move `MockLink` types to `MockLink` namespace. This affects the `MockedResponse`, `MockLinkOptions`, and `ResultFunction` types. These types are still exported but are deprecated in favor of the namespace. To migrate, use the types on the `MockLink` namespace instead.
|
|
6
|
+
|
|
7
|
+
```diff
|
|
8
|
+
import {
|
|
9
|
+
- MockedResponse,
|
|
10
|
+
- MockLinkOptions,
|
|
11
|
+
- ResultFunction,
|
|
12
|
+
+ MockLink
|
|
13
|
+
} from "@apollo/client/testing";
|
|
14
|
+
|
|
15
|
+
- const mocks: MockedResponse = [];
|
|
16
|
+
+ const mocks: MockLink.MockedResponse = [];
|
|
17
|
+
|
|
18
|
+
- const result: ResultFunction = () => {/* ... */ }
|
|
19
|
+
+ const result: MockLink.ResultFunction = () => {/* ... */ }
|
|
20
|
+
|
|
21
|
+
- const options: MockLinkOptions = {}
|
|
22
|
+
+ const options: MockLink.Options = {}
|
|
23
|
+
```
|
package/.changeset/pre.json
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"afraid-grapes-call",
|
|
9
9
|
"afraid-moons-arrive",
|
|
10
10
|
"beige-mirrors-talk",
|
|
11
|
+
"beige-spiders-hope",
|
|
11
12
|
"brave-moons-juggle",
|
|
12
13
|
"brave-radios-wait",
|
|
13
14
|
"bright-ads-share",
|
|
@@ -92,6 +93,7 @@
|
|
|
92
93
|
"perfect-vans-give",
|
|
93
94
|
"polite-bees-care",
|
|
94
95
|
"poor-eels-punch",
|
|
96
|
+
"poor-spiders-hunt",
|
|
95
97
|
"popular-games-sleep",
|
|
96
98
|
"purple-bears-flash",
|
|
97
99
|
"purple-lions-cough",
|
|
@@ -101,6 +103,7 @@
|
|
|
101
103
|
"rich-eagles-cross",
|
|
102
104
|
"rich-kids-carry",
|
|
103
105
|
"rude-fans-study",
|
|
106
|
+
"selfish-spoons-approve",
|
|
104
107
|
"serious-items-develop",
|
|
105
108
|
"serious-moons-juggle",
|
|
106
109
|
"seven-dragons-repair",
|
|
@@ -114,6 +117,7 @@
|
|
|
114
117
|
"silly-knives-exist",
|
|
115
118
|
"silly-seas-confess",
|
|
116
119
|
"sixty-bats-cry",
|
|
120
|
+
"slimy-ants-bake",
|
|
117
121
|
"slimy-chicken-melt",
|
|
118
122
|
"slimy-maps-press",
|
|
119
123
|
"slow-ravens-explain",
|
|
@@ -125,10 +129,13 @@
|
|
|
125
129
|
"smooth-coins-collect",
|
|
126
130
|
"smooth-pens-reply",
|
|
127
131
|
"soft-mails-clean",
|
|
132
|
+
"sour-colts-tell",
|
|
133
|
+
"sour-guests-poke",
|
|
128
134
|
"sour-kids-deliver",
|
|
129
135
|
"sour-pillows-guess",
|
|
130
136
|
"spotty-mugs-poke",
|
|
131
137
|
"strange-seahorses-impress",
|
|
138
|
+
"strange-walls-march",
|
|
132
139
|
"strong-rivers-fry",
|
|
133
140
|
"stupid-pumpkins-travel",
|
|
134
141
|
"swift-rivers-share",
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
"@apollo/client": major
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Move internal testing utilities in `@apollo/client/testing` to `@apollo/client/testing/internal` and remove deprecated testing utilities. Some of the testing utilities exported from the `@apollo/client/testing` endpoint were not considered stable. As a result of this change, testing utilities or types exported from `@apollo/client/testing` are now considered stable and will not undergo breaking changes.
|
|
6
|
+
|
|
7
|
+
The following APIs were removed. To migrate, update usages of the following APIs as such:
|
|
8
|
+
|
|
9
|
+
**`createMockClient`**
|
|
10
|
+
|
|
11
|
+
```diff
|
|
12
|
+
- const client = createMockClient(data, query, variables);
|
|
13
|
+
+ const client = new ApolloClient({
|
|
14
|
+
+ cache: new InMemoryCache(),
|
|
15
|
+
+ link: new MockLink([
|
|
16
|
+
+ {
|
|
17
|
+
+ request: { query, variables },
|
|
18
|
+
+ result: { data },
|
|
19
|
+
+ }
|
|
20
|
+
+ ]),
|
|
21
|
+
+ });
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**`mockObservableLink`**
|
|
25
|
+
|
|
26
|
+
```diff
|
|
27
|
+
- const link = mockObservableLink();
|
|
28
|
+
+ const link = new MockSubscriptionLink();
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**`mockSingleLink`**
|
|
32
|
+
|
|
33
|
+
```diff
|
|
34
|
+
- const link = mockSingleLink({
|
|
35
|
+
- request: { query, variables },
|
|
36
|
+
- result: { data },
|
|
37
|
+
- });
|
|
38
|
+
+ const link = new MockLink([
|
|
39
|
+
+ {
|
|
40
|
+
+ request: { query, variables },
|
|
41
|
+
+ result: { data },
|
|
42
|
+
+ }
|
|
43
|
+
+ ]);
|
|
44
|
+
```
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,84 @@
|
|
|
1
1
|
# @apollo/client
|
|
2
2
|
|
|
3
|
+
## 4.0.0-alpha.15
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#12639](https://github.com/apollographql/apollo-client/pull/12639) [`1bdf489`](https://github.com/apollographql/apollo-client/commit/1bdf4893abb173c97877c71012afa15f9d3da8e6) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Move internal testing utilities in `@apollo/client/testing` to `@apollo/client/testing/internal` and remove deprecated testing utilities. Some of the testing utilities exported from the `@apollo/client/testing` endpoint were not considered stable. As a result of this change, testing utilities or types exported from `@apollo/client/testing` are now considered stable and will not undergo breaking changes.
|
|
8
|
+
|
|
9
|
+
The following APIs were removed. To migrate, update usages of the following APIs as such:
|
|
10
|
+
|
|
11
|
+
**`createMockClient`**
|
|
12
|
+
|
|
13
|
+
```diff
|
|
14
|
+
- const client = createMockClient(data, query, variables);
|
|
15
|
+
+ const client = new ApolloClient({
|
|
16
|
+
+ cache: new InMemoryCache(),
|
|
17
|
+
+ link: new MockLink([
|
|
18
|
+
+ {
|
|
19
|
+
+ request: { query, variables },
|
|
20
|
+
+ result: { data },
|
|
21
|
+
+ }
|
|
22
|
+
+ ]),
|
|
23
|
+
+ });
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**`mockObservableLink`**
|
|
27
|
+
|
|
28
|
+
```diff
|
|
29
|
+
- const link = mockObservableLink();
|
|
30
|
+
+ const link = new MockSubscriptionLink();
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**`mockSingleLink`**
|
|
34
|
+
|
|
35
|
+
```diff
|
|
36
|
+
- const link = mockSingleLink({
|
|
37
|
+
- request: { query, variables },
|
|
38
|
+
- result: { data },
|
|
39
|
+
- });
|
|
40
|
+
+ const link = new MockLink([
|
|
41
|
+
+ {
|
|
42
|
+
+ request: { query, variables },
|
|
43
|
+
+ result: { data },
|
|
44
|
+
+ }
|
|
45
|
+
+ ]);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
- [#12637](https://github.com/apollographql/apollo-client/pull/12637) [`d2a60d4`](https://github.com/apollographql/apollo-client/commit/d2a60d45e734a2518dad2443f85d82553cd6456a) Thanks [@phryneas](https://github.com/phryneas)! - `useQuery`: only advance `previousData` if `data` actually changed
|
|
49
|
+
|
|
50
|
+
- [#12631](https://github.com/apollographql/apollo-client/pull/12631) [`b147cac`](https://github.com/apollographql/apollo-client/commit/b147cac5c96c44bfc3deb72c12c7521981584c12) Thanks [@phryneas](https://github.com/phryneas)! - `ObservableQuery` will now return a `loading: false` state for `fetchPolicy` `standby`, even before subscription
|
|
51
|
+
|
|
52
|
+
- [#12639](https://github.com/apollographql/apollo-client/pull/12639) [`1bdf489`](https://github.com/apollographql/apollo-client/commit/1bdf4893abb173c97877c71012afa15f9d3da8e6) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Remove the `@apollo/client/testing/core` entrypoint in favor of `@apollo/client/testing`.
|
|
53
|
+
|
|
54
|
+
### Minor Changes
|
|
55
|
+
|
|
56
|
+
- [#12639](https://github.com/apollographql/apollo-client/pull/12639) [`1bdf489`](https://github.com/apollographql/apollo-client/commit/1bdf4893abb173c97877c71012afa15f9d3da8e6) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Move `MockLink` types to `MockLink` namespace. This affects the `MockedResponse`, `MockLinkOptions`, and `ResultFunction` types. These types are still exported but are deprecated in favor of the namespace. To migrate, use the types on the `MockLink` namespace instead.
|
|
57
|
+
|
|
58
|
+
```diff
|
|
59
|
+
import {
|
|
60
|
+
- MockedResponse,
|
|
61
|
+
- MockLinkOptions,
|
|
62
|
+
- ResultFunction,
|
|
63
|
+
+ MockLink
|
|
64
|
+
} from "@apollo/client/testing";
|
|
65
|
+
|
|
66
|
+
- const mocks: MockedResponse = [];
|
|
67
|
+
+ const mocks: MockLink.MockedResponse = [];
|
|
68
|
+
|
|
69
|
+
- const result: ResultFunction = () => {/* ... */ }
|
|
70
|
+
+ const result: MockLink.ResultFunction = () => {/* ... */ }
|
|
71
|
+
|
|
72
|
+
- const options: MockLinkOptions = {}
|
|
73
|
+
+ const options: MockLink.Options = {}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Patch Changes
|
|
77
|
+
|
|
78
|
+
- [#12631](https://github.com/apollographql/apollo-client/pull/12631) [`b147cac`](https://github.com/apollographql/apollo-client/commit/b147cac5c96c44bfc3deb72c12c7521981584c12) Thanks [@phryneas](https://github.com/phryneas)! - When updating `skip` from `false` to `true` in `useQuery`, retain `data` if it is available rather than setting it to `undefined`.
|
|
79
|
+
|
|
80
|
+
- [#12631](https://github.com/apollographql/apollo-client/pull/12631) [`b147cac`](https://github.com/apollographql/apollo-client/commit/b147cac5c96c44bfc3deb72c12c7521981584c12) Thanks [@phryneas](https://github.com/phryneas)! - The `error` property is no longer present when `skip` is `true` in `useQuery`.
|
|
81
|
+
|
|
3
82
|
## 4.0.0-alpha.14
|
|
4
83
|
|
|
5
84
|
### Major Changes
|
|
@@ -236,6 +236,12 @@ class ObservableQuery {
|
|
|
236
236
|
loading: true,
|
|
237
237
|
networkStatus: networkStatus_js_1.NetworkStatus.loading,
|
|
238
238
|
};
|
|
239
|
+
case "standby":
|
|
240
|
+
return {
|
|
241
|
+
...defaultResult,
|
|
242
|
+
loading: false,
|
|
243
|
+
networkStatus: networkStatus_js_1.NetworkStatus.ready,
|
|
244
|
+
};
|
|
239
245
|
default:
|
|
240
246
|
return defaultResult;
|
|
241
247
|
}
|