@khanacademy/wonder-blocks-data 14.0.7 → 14.1.0
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/CHANGELOG.md +212 -195
- package/LICENSE +21 -0
- package/dist/components/data.d.ts +1 -1
- package/dist/es/index.js +13 -13
- package/dist/hooks/use-cached-effect.d.ts +1 -1
- package/dist/hooks/use-hydratable-effect.d.ts +1 -1
- package/dist/index.js +18 -24
- package/dist/util/data-error.d.ts +1 -1
- package/dist/util/gql-error.d.ts +1 -1
- package/dist/util/graphql-document-node-parser.d.ts +1 -1
- package/package.json +11 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,241 +1,258 @@
|
|
|
1
1
|
# @khanacademy/wonder-blocks-data
|
|
2
2
|
|
|
3
|
+
## 14.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- f03298f: Tooling:
|
|
8
|
+
|
|
9
|
+
- Switching to `pnpm`.
|
|
10
|
+
- Upgrading `rollup` to v4 and `@babel/runtime` to match the current webapp version.
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- bb2a026: pnpm: Switch to workspace protocol to handle dependency versions with changesets on monorepo setup"
|
|
15
|
+
- Updated dependencies [969864b]
|
|
16
|
+
- Updated dependencies [bb2a026]
|
|
17
|
+
- Updated dependencies [f03298f]
|
|
18
|
+
- @khanacademy/wonder-blocks-core@12.1.0
|
|
19
|
+
|
|
3
20
|
## 14.0.7
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
6
23
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
24
|
+
- Updated dependencies [0199324d]
|
|
25
|
+
- @khanacademy/wonder-blocks-core@12.0.0
|
|
9
26
|
|
|
10
27
|
## 14.0.6
|
|
11
28
|
|
|
12
29
|
### Patch Changes
|
|
13
30
|
|
|
14
|
-
-
|
|
15
|
-
-
|
|
31
|
+
- Updated dependencies [7516b239]
|
|
32
|
+
- @khanacademy/wonder-blocks-core@11.1.0
|
|
16
33
|
|
|
17
34
|
## 14.0.5
|
|
18
35
|
|
|
19
36
|
### Patch Changes
|
|
20
37
|
|
|
21
|
-
-
|
|
38
|
+
- faf7bd21: Version bump to verify release protections
|
|
22
39
|
|
|
23
40
|
## 14.0.4
|
|
24
41
|
|
|
25
42
|
### Patch Changes
|
|
26
43
|
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
44
|
+
- 11a0f5c6: No functional changes. Adding prepublishOnly script.
|
|
45
|
+
- Updated dependencies [11a0f5c6]
|
|
46
|
+
- @khanacademy/wonder-blocks-core@11.0.1
|
|
30
47
|
|
|
31
48
|
## 14.0.3
|
|
32
49
|
|
|
33
50
|
### Patch Changes
|
|
34
51
|
|
|
35
|
-
-
|
|
36
|
-
-
|
|
52
|
+
- Updated dependencies [d23c9c5f]
|
|
53
|
+
- @khanacademy/wonder-blocks-core@11.0.0
|
|
37
54
|
|
|
38
55
|
## 14.0.2
|
|
39
56
|
|
|
40
57
|
### Patch Changes
|
|
41
58
|
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
59
|
+
- Updated dependencies [b6009b77]
|
|
60
|
+
- Updated dependencies [897686bc]
|
|
61
|
+
- Updated dependencies [56d961f1]
|
|
62
|
+
- @khanacademy/wonder-blocks-core@10.0.0
|
|
46
63
|
|
|
47
64
|
## 14.0.1
|
|
48
65
|
|
|
49
66
|
### Patch Changes
|
|
50
67
|
|
|
51
|
-
-
|
|
52
|
-
-
|
|
68
|
+
- Updated dependencies [f4abd572]
|
|
69
|
+
- @khanacademy/wonder-blocks-core@9.0.0
|
|
53
70
|
|
|
54
71
|
## 14.0.0
|
|
55
72
|
|
|
56
73
|
### Major Changes
|
|
57
74
|
|
|
58
|
-
-
|
|
75
|
+
- e6abdd17: Upgrade to React 18
|
|
59
76
|
|
|
60
77
|
### Patch Changes
|
|
61
78
|
|
|
62
|
-
-
|
|
63
|
-
-
|
|
79
|
+
- Updated dependencies [e6abdd17]
|
|
80
|
+
- @khanacademy/wonder-blocks-core@8.0.0
|
|
64
81
|
|
|
65
82
|
## 13.0.12
|
|
66
83
|
|
|
67
84
|
### Patch Changes
|
|
68
85
|
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
-
|
|
86
|
+
- 02a1b298: Make sure we don't package tsconfig and tsbuildinfo files
|
|
87
|
+
- Updated dependencies [02a1b298]
|
|
88
|
+
- @khanacademy/wonder-blocks-core@7.0.1
|
|
72
89
|
|
|
73
90
|
## 13.0.11
|
|
74
91
|
|
|
75
92
|
### Patch Changes
|
|
76
93
|
|
|
77
|
-
-
|
|
78
|
-
-
|
|
94
|
+
- Updated dependencies [07f7f407]
|
|
95
|
+
- @khanacademy/wonder-blocks-core@7.0.0
|
|
79
96
|
|
|
80
97
|
## 13.0.10
|
|
81
98
|
|
|
82
99
|
### Patch Changes
|
|
83
100
|
|
|
84
|
-
-
|
|
85
|
-
-
|
|
86
|
-
-
|
|
101
|
+
- 559e82d5: Update to build tooling, generating smaller output
|
|
102
|
+
- Updated dependencies [559e82d5]
|
|
103
|
+
- @khanacademy/wonder-blocks-core@6.4.3
|
|
87
104
|
|
|
88
105
|
## 13.0.9
|
|
89
106
|
|
|
90
107
|
### Patch Changes
|
|
91
108
|
|
|
92
|
-
-
|
|
93
|
-
-
|
|
94
|
-
-
|
|
109
|
+
- eab37b8b: Test file changes only. No external changes at all.
|
|
110
|
+
- Updated dependencies [eab37b8b]
|
|
111
|
+
- @khanacademy/wonder-blocks-core@6.4.2
|
|
95
112
|
|
|
96
113
|
## 13.0.8
|
|
97
114
|
|
|
98
115
|
### Patch Changes
|
|
99
116
|
|
|
100
|
-
-
|
|
101
|
-
-
|
|
117
|
+
- Updated dependencies [5dfac06e]
|
|
118
|
+
- @khanacademy/wonder-blocks-core@6.4.1
|
|
102
119
|
|
|
103
120
|
## 13.0.7
|
|
104
121
|
|
|
105
122
|
### Patch Changes
|
|
106
123
|
|
|
107
|
-
-
|
|
108
|
-
-
|
|
124
|
+
- Updated dependencies [58075352]
|
|
125
|
+
- @khanacademy/wonder-blocks-core@6.4.0
|
|
109
126
|
|
|
110
127
|
## 13.0.6
|
|
111
128
|
|
|
112
129
|
### Patch Changes
|
|
113
130
|
|
|
114
|
-
-
|
|
115
|
-
-
|
|
131
|
+
- Updated dependencies [6df21f71]
|
|
132
|
+
- @khanacademy/wonder-blocks-core@6.3.1
|
|
116
133
|
|
|
117
134
|
## 13.0.5
|
|
118
135
|
|
|
119
136
|
### Patch Changes
|
|
120
137
|
|
|
121
|
-
-
|
|
122
|
-
-
|
|
138
|
+
- Updated dependencies [7055ca94]
|
|
139
|
+
- @khanacademy/wonder-blocks-core@6.3.0
|
|
123
140
|
|
|
124
141
|
## 13.0.4
|
|
125
142
|
|
|
126
143
|
### Patch Changes
|
|
127
144
|
|
|
128
|
-
-
|
|
129
|
-
-
|
|
145
|
+
- Updated dependencies [4b97b9a2]
|
|
146
|
+
- @khanacademy/wonder-blocks-core@6.2.0
|
|
130
147
|
|
|
131
148
|
## 13.0.3
|
|
132
149
|
|
|
133
150
|
### Patch Changes
|
|
134
151
|
|
|
135
|
-
-
|
|
136
|
-
-
|
|
152
|
+
- Updated dependencies [2871f0a9]
|
|
153
|
+
- @khanacademy/wonder-blocks-core@6.1.1
|
|
137
154
|
|
|
138
155
|
## 13.0.2
|
|
139
156
|
|
|
140
157
|
### Patch Changes
|
|
141
158
|
|
|
142
|
-
-
|
|
143
|
-
-
|
|
144
|
-
-
|
|
159
|
+
- Updated dependencies [efb59c29]
|
|
160
|
+
- Updated dependencies [8bc40ed2]
|
|
161
|
+
- @khanacademy/wonder-blocks-core@6.1.0
|
|
145
162
|
|
|
146
163
|
## 13.0.1
|
|
147
164
|
|
|
148
165
|
### Patch Changes
|
|
149
166
|
|
|
150
|
-
-
|
|
151
|
-
-
|
|
167
|
+
- Updated dependencies [f19da46e]
|
|
168
|
+
- @khanacademy/wonder-blocks-core@6.0.2
|
|
152
169
|
|
|
153
170
|
## 13.0.0
|
|
154
171
|
|
|
155
172
|
### Major Changes
|
|
156
173
|
|
|
157
|
-
-
|
|
174
|
+
- 65c02cff: Return new no-data state from useCachedEffect when it is not loading and there is no data to return
|
|
158
175
|
|
|
159
176
|
### Patch Changes
|
|
160
177
|
|
|
161
|
-
-
|
|
162
|
-
-
|
|
178
|
+
- Updated dependencies [1920feb8]
|
|
179
|
+
- @khanacademy/wonder-blocks-core@6.0.1
|
|
163
180
|
|
|
164
181
|
## 12.0.0
|
|
165
182
|
|
|
166
183
|
### Major Changes
|
|
167
184
|
|
|
168
|
-
-
|
|
185
|
+
- 674a1e5c: POJOs have been replace with TS enums
|
|
169
186
|
|
|
170
187
|
### Patch Changes
|
|
171
188
|
|
|
172
|
-
-
|
|
173
|
-
-
|
|
174
|
-
-
|
|
175
|
-
-
|
|
189
|
+
- 674a1e5c: We're no longer building flow types
|
|
190
|
+
- Updated dependencies [674a1e5c]
|
|
191
|
+
- Updated dependencies [674a1e5c]
|
|
192
|
+
- @khanacademy/wonder-blocks-core@6.0.0
|
|
176
193
|
|
|
177
194
|
## 11.0.16
|
|
178
195
|
|
|
179
196
|
### Patch Changes
|
|
180
197
|
|
|
181
|
-
-
|
|
182
|
-
-
|
|
198
|
+
- Updated dependencies [1344436f]
|
|
199
|
+
- @khanacademy/wonder-blocks-core@5.4.0
|
|
183
200
|
|
|
184
201
|
## 11.0.15
|
|
185
202
|
|
|
186
203
|
### Patch Changes
|
|
187
204
|
|
|
188
|
-
-
|
|
189
|
-
-
|
|
205
|
+
- Updated dependencies [9f3752d4]
|
|
206
|
+
- @khanacademy/wonder-blocks-core@5.3.1
|
|
190
207
|
|
|
191
208
|
## 11.0.14
|
|
192
209
|
|
|
193
210
|
### Patch Changes
|
|
194
211
|
|
|
195
|
-
-
|
|
196
|
-
-
|
|
197
|
-
-
|
|
212
|
+
- Updated dependencies [c37b99aa]
|
|
213
|
+
- Updated dependencies [c4cef3e6]
|
|
214
|
+
- @khanacademy/wonder-blocks-core@5.3.0
|
|
198
215
|
|
|
199
216
|
## 11.0.13
|
|
200
217
|
|
|
201
218
|
### Patch Changes
|
|
202
219
|
|
|
203
|
-
-
|
|
204
|
-
-
|
|
220
|
+
- Updated dependencies [d4c412b5]
|
|
221
|
+
- @khanacademy/wonder-blocks-core@5.2.3
|
|
205
222
|
|
|
206
223
|
## 11.0.12
|
|
207
224
|
|
|
208
225
|
### Patch Changes
|
|
209
226
|
|
|
210
|
-
-
|
|
211
|
-
-
|
|
227
|
+
- Updated dependencies [64a188e3]
|
|
228
|
+
- @khanacademy/wonder-blocks-core@5.2.2
|
|
212
229
|
|
|
213
230
|
## 11.0.11
|
|
214
231
|
|
|
215
232
|
### Patch Changes
|
|
216
233
|
|
|
217
|
-
-
|
|
218
|
-
-
|
|
219
|
-
-
|
|
220
|
-
-
|
|
234
|
+
- 5a1ea891: Make sure that React contexts are named
|
|
235
|
+
- Updated dependencies [5a1ea891]
|
|
236
|
+
- Updated dependencies [df9a10aa]
|
|
237
|
+
- @khanacademy/wonder-blocks-core@5.2.1
|
|
221
238
|
|
|
222
239
|
## 11.0.10
|
|
223
240
|
|
|
224
241
|
### Patch Changes
|
|
225
242
|
|
|
226
|
-
-
|
|
227
|
-
-
|
|
228
|
-
-
|
|
229
|
-
-
|
|
243
|
+
- Updated dependencies [fa70c895]
|
|
244
|
+
- Updated dependencies [19ab0408]
|
|
245
|
+
- Updated dependencies [fa70c895]
|
|
246
|
+
- @khanacademy/wonder-blocks-core@5.2.0
|
|
230
247
|
|
|
231
248
|
## 11.0.9
|
|
232
249
|
|
|
233
250
|
### Patch Changes
|
|
234
251
|
|
|
235
|
-
-
|
|
236
|
-
-
|
|
237
|
-
-
|
|
238
|
-
-
|
|
252
|
+
- a6164ed0: Don't use React.FC<> for functional components
|
|
253
|
+
- Updated dependencies [3c400719]
|
|
254
|
+
- Updated dependencies [a6164ed0]
|
|
255
|
+
- @khanacademy/wonder-blocks-core@5.1.0
|
|
239
256
|
|
|
240
257
|
## 11.0.8
|
|
241
258
|
|
|
@@ -245,343 +262,343 @@
|
|
|
245
262
|
|
|
246
263
|
### Patch Changes
|
|
247
264
|
|
|
248
|
-
-
|
|
249
|
-
-
|
|
250
|
-
-
|
|
265
|
+
- c20f48f3: Don't transpile classes when building bundles
|
|
266
|
+
- Updated dependencies [c20f48f3]
|
|
267
|
+
- @khanacademy/wonder-blocks-core@5.0.4
|
|
251
268
|
|
|
252
269
|
## 11.0.5
|
|
253
270
|
|
|
254
271
|
### Patch Changes
|
|
255
272
|
|
|
256
|
-
-
|
|
273
|
+
- 43155769: Fix DocumentNode type definition
|
|
257
274
|
|
|
258
275
|
## 11.0.4
|
|
259
276
|
|
|
260
277
|
### Patch Changes
|
|
261
278
|
|
|
262
|
-
-
|
|
279
|
+
- bedcbcf8: Update <Data>'s 'children' prop to allow a ReactNode to be returned
|
|
263
280
|
|
|
264
281
|
## 11.0.3
|
|
265
282
|
|
|
266
283
|
### Patch Changes
|
|
267
284
|
|
|
268
|
-
-
|
|
269
|
-
-
|
|
285
|
+
- Updated dependencies [b281e2eb]
|
|
286
|
+
- @khanacademy/wonder-blocks-core@5.0.3
|
|
270
287
|
|
|
271
288
|
## 11.0.2
|
|
272
289
|
|
|
273
290
|
### Patch Changes
|
|
274
291
|
|
|
275
|
-
-
|
|
276
|
-
-
|
|
292
|
+
- Updated dependencies [21ce20c7]
|
|
293
|
+
- @khanacademy/wonder-blocks-core@5.0.2
|
|
277
294
|
|
|
278
295
|
## 11.0.1
|
|
279
296
|
|
|
280
297
|
### Patch Changes
|
|
281
298
|
|
|
282
|
-
-
|
|
283
|
-
-
|
|
284
|
-
-
|
|
285
|
-
-
|
|
286
|
-
-
|
|
299
|
+
- ccb6fe00: Miscellaneous TS type fixes
|
|
300
|
+
- d4c2b18c: Fix a variety of issues with Flow types generated by flowgen
|
|
301
|
+
- Updated dependencies [ccb6fe00]
|
|
302
|
+
- Updated dependencies [d4c2b18c]
|
|
303
|
+
- @khanacademy/wonder-blocks-core@5.0.1
|
|
287
304
|
|
|
288
305
|
## 11.0.0
|
|
289
306
|
|
|
290
307
|
### Major Changes
|
|
291
308
|
|
|
292
|
-
-
|
|
309
|
+
- 1ca4d7e3: Fix minor issue with generate Flow types (this is a major bump b/c I forgot to do one after doing the TS conversion)
|
|
293
310
|
|
|
294
311
|
### Patch Changes
|
|
295
312
|
|
|
296
|
-
-
|
|
297
|
-
-
|
|
313
|
+
- Updated dependencies [1ca4d7e3]
|
|
314
|
+
- @khanacademy/wonder-blocks-core@5.0.0
|
|
298
315
|
|
|
299
316
|
## 10.1.3
|
|
300
317
|
|
|
301
318
|
### Patch Changes
|
|
302
319
|
|
|
303
|
-
-
|
|
304
|
-
-
|
|
305
|
-
-
|
|
320
|
+
- b5ba5568: Ensure that flow lib defs use React.ElementConfig<> isntead of JSX.LibraryManagedAttributes<>
|
|
321
|
+
- Updated dependencies [b5ba5568]
|
|
322
|
+
- @khanacademy/wonder-blocks-core@4.9.1
|
|
306
323
|
|
|
307
324
|
## 10.1.2
|
|
308
325
|
|
|
309
326
|
### Patch Changes
|
|
310
327
|
|
|
311
|
-
-
|
|
312
|
-
-
|
|
328
|
+
- Updated dependencies [779b031d]
|
|
329
|
+
- @khanacademy/wonder-blocks-core@4.9.0
|
|
313
330
|
|
|
314
331
|
## 10.1.1
|
|
315
332
|
|
|
316
333
|
### Patch Changes
|
|
317
334
|
|
|
318
|
-
-
|
|
319
|
-
-
|
|
320
|
-
-
|
|
321
|
-
-
|
|
322
|
-
-
|
|
323
|
-
-
|
|
324
|
-
-
|
|
325
|
-
-
|
|
326
|
-
-
|
|
327
|
-
-
|
|
328
|
-
-
|
|
329
|
-
-
|
|
330
|
-
-
|
|
331
|
-
-
|
|
332
|
-
-
|
|
333
|
-
-
|
|
334
|
-
-
|
|
335
|
-
-
|
|
336
|
-
-
|
|
335
|
+
- d816af08: Update build and test configs use TypeScript
|
|
336
|
+
- 3891f544: Update babel config to include plugins that Storybook needed
|
|
337
|
+
- 3813715d: Update wonder-stuff dependencies (non-functional changes)
|
|
338
|
+
- 0d28bb1c: Configured TypeScript
|
|
339
|
+
- 3d05f764: Fix HOCs and other type errors
|
|
340
|
+
- c2ec4902: Update eslint configuration, fix lint
|
|
341
|
+
- 2983c05b: Include 'types' field in package.json
|
|
342
|
+
- 77ff6a66: Generate Flow types from TypeScript types
|
|
343
|
+
- ec8d4b7f: Fix miscellaneous TypeScript errors
|
|
344
|
+
- Updated dependencies [d816af08]
|
|
345
|
+
- Updated dependencies [3891f544]
|
|
346
|
+
- Updated dependencies [0d28bb1c]
|
|
347
|
+
- Updated dependencies [873f4a14]
|
|
348
|
+
- Updated dependencies [3d05f764]
|
|
349
|
+
- Updated dependencies [c2ec4902]
|
|
350
|
+
- Updated dependencies [2983c05b]
|
|
351
|
+
- Updated dependencies [77ff6a66]
|
|
352
|
+
- Updated dependencies [ec8d4b7f]
|
|
353
|
+
- @khanacademy/wonder-blocks-core@4.8.0
|
|
337
354
|
|
|
338
355
|
## 10.1.0
|
|
339
356
|
|
|
340
357
|
### Minor Changes
|
|
341
358
|
|
|
342
|
-
-
|
|
359
|
+
- 91cb727c: Convert enums to POJOs
|
|
343
360
|
|
|
344
361
|
### Patch Changes
|
|
345
362
|
|
|
346
|
-
-
|
|
347
|
-
-
|
|
348
|
-
-
|
|
349
|
-
-
|
|
350
|
-
-
|
|
363
|
+
- 91cb727c: Update wonder-stuff dependencies
|
|
364
|
+
- 91cb727c: Remove file extensions from imports
|
|
365
|
+
- Updated dependencies [91cb727c]
|
|
366
|
+
- Updated dependencies [91cb727c]
|
|
367
|
+
- @khanacademy/wonder-blocks-core@4.7.0
|
|
351
368
|
|
|
352
369
|
## 10.0.5
|
|
353
370
|
|
|
354
371
|
### Patch Changes
|
|
355
372
|
|
|
356
|
-
-
|
|
373
|
+
- 1a5624d4: Update wonder-stuff dependencies to use newly published packages after migrating wonder-stuff to TypeScript
|
|
357
374
|
|
|
358
375
|
## 10.0.4
|
|
359
376
|
|
|
360
377
|
### Patch Changes
|
|
361
378
|
|
|
362
|
-
-
|
|
363
|
-
-
|
|
379
|
+
- Updated dependencies [496119f2]
|
|
380
|
+
- @khanacademy/wonder-blocks-core@4.6.2
|
|
364
381
|
|
|
365
382
|
## 10.0.3
|
|
366
383
|
|
|
367
384
|
### Patch Changes
|
|
368
385
|
|
|
369
|
-
-
|
|
386
|
+
- @khanacademy/wonder-blocks-core@4.6.1
|
|
370
387
|
|
|
371
388
|
## 10.0.2
|
|
372
389
|
|
|
373
390
|
### Patch Changes
|
|
374
391
|
|
|
375
|
-
-
|
|
376
|
-
-
|
|
377
|
-
-
|
|
378
|
-
-
|
|
392
|
+
- Updated dependencies [b561425a]
|
|
393
|
+
- Updated dependencies [a566e232]
|
|
394
|
+
- Updated dependencies [d2b21a6e]
|
|
395
|
+
- @khanacademy/wonder-blocks-core@4.6.0
|
|
379
396
|
|
|
380
397
|
## 10.0.1
|
|
381
398
|
|
|
382
399
|
### Patch Changes
|
|
383
400
|
|
|
384
|
-
-
|
|
385
|
-
-
|
|
401
|
+
- Updated dependencies [175a2dd2]
|
|
402
|
+
- @khanacademy/wonder-blocks-core@4.5.0
|
|
386
403
|
|
|
387
404
|
## 10.0.0
|
|
388
405
|
|
|
389
406
|
### Major Changes
|
|
390
407
|
|
|
391
|
-
-
|
|
408
|
+
- 5a3ec7f9: Make sure request ID generation handles objects like Date and Error instances better
|
|
392
409
|
|
|
393
410
|
## 9.1.2
|
|
394
411
|
|
|
395
412
|
### Patch Changes
|
|
396
413
|
|
|
397
|
-
-
|
|
398
|
-
-
|
|
414
|
+
- Updated dependencies [6ee20af9]
|
|
415
|
+
- @khanacademy/wonder-blocks-core@4.4.0
|
|
399
416
|
|
|
400
417
|
## 9.1.1
|
|
401
418
|
|
|
402
419
|
### Patch Changes
|
|
403
420
|
|
|
404
|
-
-
|
|
421
|
+
- eb59ce34: Update to latest Wonder Stuff Core
|
|
405
422
|
|
|
406
423
|
## 9.1.0
|
|
407
424
|
|
|
408
425
|
### Minor Changes
|
|
409
426
|
|
|
410
|
-
-
|
|
427
|
+
- 944c3071: Make sure objects and arrays in variables are sorted and readable in generated request identifiers
|
|
411
428
|
|
|
412
429
|
## 9.0.0
|
|
413
430
|
|
|
414
431
|
### Major Changes
|
|
415
432
|
|
|
416
|
-
-
|
|
417
|
-
-
|
|
433
|
+
- 778f8e43: `SharedCache` export added for interacting with the shared in-memory cache. `purgeSharedCache` method has been removed.
|
|
434
|
+
- 778f8e43: Rename `ScopedCache` type to `RawScopedCache`
|
|
418
435
|
|
|
419
436
|
## 8.0.5
|
|
420
437
|
|
|
421
438
|
### Patch Changes
|
|
422
439
|
|
|
423
|
-
-
|
|
440
|
+
- 08238b89: Export the `getGqlDataFromResponse` method so we can use it in custom `gqlFetch` scenarios for a consistent experience
|
|
424
441
|
|
|
425
442
|
## 8.0.4
|
|
426
443
|
|
|
427
444
|
### Patch Changes
|
|
428
445
|
|
|
429
|
-
-
|
|
446
|
+
- dc2e00f4: Do not fetch if FetchPolicy is CacheBeforeNetwork and there is already a cached value, even if the requestId changes
|
|
430
447
|
|
|
431
448
|
## 8.0.3
|
|
432
449
|
|
|
433
450
|
### Patch Changes
|
|
434
451
|
|
|
435
|
-
-
|
|
436
|
-
-
|
|
437
|
-
-
|
|
438
|
-
-
|
|
439
|
-
-
|
|
452
|
+
- 5f4a4297: Make dependency on `flow-enums-runtime` explicit
|
|
453
|
+
- 2b96fd59: Change flow-enums-runtime to be peer dependencies
|
|
454
|
+
- Updated dependencies [5f4a4297]
|
|
455
|
+
- Updated dependencies [2b96fd59]
|
|
456
|
+
- @khanacademy/wonder-blocks-core@4.3.2
|
|
440
457
|
|
|
441
458
|
## 8.0.2
|
|
442
459
|
|
|
443
460
|
### Patch Changes
|
|
444
461
|
|
|
445
|
-
-
|
|
462
|
+
- 580141ed: Always initialize SSR-only cache
|
|
446
463
|
|
|
447
464
|
## 8.0.1
|
|
448
465
|
|
|
449
466
|
### Patch Changes
|
|
450
467
|
|
|
451
|
-
-
|
|
468
|
+
- e5fa4d9e: Make sure ssr-only cache is initialized when purging caches in test environment
|
|
452
469
|
|
|
453
470
|
## 8.0.0
|
|
454
471
|
|
|
455
472
|
### Major Changes
|
|
456
473
|
|
|
457
|
-
-
|
|
458
|
-
-
|
|
459
|
-
-
|
|
460
|
-
-
|
|
461
|
-
-
|
|
474
|
+
- 0720470e: Renamed `initializeCache` to `initializeHydrationCache`, deleted `removeFromCache`, renamed `removeAllFromCache` to `purgeHydrationCache`
|
|
475
|
+
- cf9ed87f: Add `fetchPolicy` to `useCachedEffect` options, add `refetch` to `useCachedEffect` return value (return value is now a tuple of [result, refetch]), add abort API to request fulfillment (not truly aborting though)
|
|
476
|
+
- b882b082: Stop exporting `RequestFulfillment`, update `useCachedEffect` to consider scope with sharing inflight requests
|
|
477
|
+
- 0720470e: Rename `fulfillAllDataRequests` to `fetchTrackedRequests`, rename `hasUnfulfilledRequests` to `hasTrackedRequestsToBeFetched`
|
|
478
|
+
- 0720470e: Renamed `clearSharedCache` to `purgeSharedCache`
|
|
462
479
|
|
|
463
480
|
### Minor Changes
|
|
464
481
|
|
|
465
|
-
-
|
|
466
|
-
-
|
|
467
|
-
-
|
|
482
|
+
- 0720470e: Add `purgeCaches` export for purging all caches with one call
|
|
483
|
+
- 75c10036: Add `abortInflightRequests` to exports
|
|
484
|
+
- a85f2f3a: Provide `getGqlRequestId` function
|
|
468
485
|
|
|
469
486
|
### Patch Changes
|
|
470
487
|
|
|
471
|
-
-
|
|
488
|
+
- 1385f468: Removed unnecessary `new` on tracking context creation
|
|
472
489
|
|
|
473
490
|
## 7.0.1
|
|
474
491
|
|
|
475
492
|
### Patch Changes
|
|
476
493
|
|
|
477
|
-
-
|
|
494
|
+
- @khanacademy/wonder-blocks-core@4.3.1
|
|
478
495
|
|
|
479
496
|
## 7.0.0
|
|
480
497
|
|
|
481
498
|
### Major Changes
|
|
482
499
|
|
|
483
|
-
-
|
|
500
|
+
- 34407c4a: `useServerEffect` now has a `skip` option, preventing the request from getting tracked for server-side fulfillment
|
|
484
501
|
|
|
485
502
|
## 6.0.1
|
|
486
503
|
|
|
487
504
|
### Patch Changes
|
|
488
505
|
|
|
489
|
-
-
|
|
506
|
+
- 5ad01891: [FIX] Make sure hydratable effect properly renders when requestId changes
|
|
490
507
|
|
|
491
508
|
## 6.0.0
|
|
492
509
|
|
|
493
510
|
### Major Changes
|
|
494
511
|
|
|
495
|
-
-
|
|
496
|
-
-
|
|
497
|
-
-
|
|
498
|
-
-
|
|
499
|
-
-
|
|
512
|
+
- 1f34c4e8: `Result<TData>` is now the main return type, `useGql` supports context modification, and context overrides that are set explicitly to null now mean those values are deleted when merging
|
|
513
|
+
- 885fe62b: [NEW] `useCachedEffect` hook for performing asynchronous work client-side and caching the result. Updated `useHydratableEffect` to use `useCachedEffect`. `useServerEffect` handler is now interceptable with Wonder Blocks Data `InterceptData` component.
|
|
514
|
+
- 5c852025: [NEW] Added the `useHydratableEffect` hook and updated the `Data` component to use it. Breaking change: `Data` props have been renamed and retyped to fit `useHydratableResult` API.
|
|
515
|
+
- c91f3959: New `DataError` type and changes to the `GqlError` type. Also changes what errors are thrown in various code
|
|
516
|
+
- 753220a4: Exported in-flight request tracking mechanism and reworked Data component so that client-side requests don't get morphed to and from a cache-style value
|
|
500
517
|
|
|
501
518
|
### Minor Changes
|
|
502
519
|
|
|
503
|
-
-
|
|
520
|
+
- 5d614ed4: Changed `Result<TData>` error status so that error field is an error object, not a string
|
|
504
521
|
|
|
505
522
|
### Patch Changes
|
|
506
523
|
|
|
507
|
-
-
|
|
508
|
-
-
|
|
524
|
+
- Updated dependencies [246a921d]
|
|
525
|
+
- @khanacademy/wonder-blocks-core@4.3.0
|
|
509
526
|
|
|
510
527
|
## 5.0.1
|
|
511
528
|
|
|
512
529
|
### Patch Changes
|
|
513
530
|
|
|
514
|
-
-
|
|
531
|
+
- c9922b34: Export resultFromCachedResponse
|
|
515
532
|
|
|
516
533
|
## 5.0.0
|
|
517
534
|
|
|
518
535
|
### Major Changes
|
|
519
536
|
|
|
520
|
-
-
|
|
537
|
+
- 5b5f85ac: Replace `InterceptData` with `InterceptRequests` and introduce new `useRequestInterception` hook
|
|
521
538
|
|
|
522
539
|
## 4.0.0
|
|
523
540
|
|
|
524
541
|
### Major Changes
|
|
525
542
|
|
|
526
|
-
-
|
|
527
|
-
-
|
|
528
|
-
-
|
|
529
|
-
-
|
|
530
|
-
-
|
|
531
|
-
-
|
|
543
|
+
- febc7309: Rename types and update signatures
|
|
544
|
+
- `ValidData` is now `ValidCacheData`
|
|
545
|
+
- `Cache` type is now `ResponseCache` (old `ResponseCache` can be created with `$ReadOnly<ResponseCache>`)
|
|
546
|
+
- `CacheEntry` type is now `CachedResponse`
|
|
547
|
+
- Signatures that were typed as `$ReadOnly<Cache>` previously are now typed as `ResponseCache` which is more appropriate to how they work
|
|
548
|
+
- bffc345e: Simplified, more versatile API
|
|
532
549
|
|
|
533
|
-
-
|
|
534
|
-
-
|
|
535
|
-
-
|
|
550
|
+
- NEW: `useServerEffect` hook - a way to perform asynchronous tasks on the server and have the value available for hydration
|
|
551
|
+
- UPDATED: `Data` component - New API that does away with the `IRequestHandler` interface. Includes new props to control behavior on hydration and when new requests occur.
|
|
552
|
+
- UPDATED: `InterceptData` component - New API to reflect changes in `Data` component.
|
|
536
553
|
|
|
537
|
-
-
|
|
538
|
-
-
|
|
554
|
+
- REMOVED: `IRequestHandler` API. All associated call signatures have been updated to reflect this.
|
|
555
|
+
- REMOVED: `useData` hook - The `Data` component should be used
|
|
539
556
|
|
|
540
557
|
### Minor Changes
|
|
541
558
|
|
|
542
|
-
-
|
|
543
|
-
-
|
|
559
|
+
- 7c9dd09b: - New `useSharedData` hook
|
|
560
|
+
- New `ScopedInMemoryCache` export
|
|
544
561
|
|
|
545
562
|
## 3.2.0
|
|
546
563
|
|
|
547
564
|
### Minor Changes
|
|
548
565
|
|
|
549
|
-
-
|
|
566
|
+
- 6973afa2: useGql method now merges defaultContext and partial context by ignoring values explicitly set to undefined in the partial context. This ensures that that existing default context values are not overridden unless explicitly given a value other than undefined.
|
|
550
567
|
|
|
551
568
|
## 3.1.3
|
|
552
569
|
|
|
553
570
|
### Patch Changes
|
|
554
571
|
|
|
555
|
-
-
|
|
572
|
+
- 9931ae6b: Simplify GQL types
|
|
556
573
|
|
|
557
574
|
## 3.1.2
|
|
558
575
|
|
|
559
576
|
### Patch Changes
|
|
560
577
|
|
|
561
|
-
-
|
|
578
|
+
- @khanacademy/wonder-blocks-core@4.2.1
|
|
562
579
|
|
|
563
580
|
## 3.1.1
|
|
564
581
|
|
|
565
582
|
### Patch Changes
|
|
566
583
|
|
|
567
|
-
-
|
|
584
|
+
- 4ff59815: Add GraphQL fetch mock support to wonder-blocks-testing
|
|
568
585
|
|
|
569
586
|
## 3.1.0
|
|
570
587
|
|
|
571
588
|
### Minor Changes
|
|
572
589
|
|
|
573
|
-
-
|
|
574
|
-
-
|
|
590
|
+
- b68cedfe: Add GqlRouter component
|
|
591
|
+
- c7233a97: Implement useGql hook
|
|
575
592
|
|
|
576
593
|
## 3.0.1
|
|
577
594
|
|
|
578
595
|
### Patch Changes
|
|
579
596
|
|
|
580
|
-
-
|
|
597
|
+
- d281dac8: Ensure server-side request fulfillments can be intercepted
|
|
581
598
|
|
|
582
599
|
## 3.0.0
|
|
583
600
|
|
|
584
601
|
### Major Changes
|
|
585
602
|
|
|
586
|
-
-
|
|
587
|
-
-
|
|
603
|
+
- b252d9c8: Remove client-side caching
|
|
604
|
+
- b252d9c8: Introduce useData hook
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 Khan Academy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -27,7 +27,7 @@ TData extends ValidCacheData> = {
|
|
|
27
27
|
*
|
|
28
28
|
* Default is `OnClientRender.ExecuteWhenNoSuccessResult`.
|
|
29
29
|
*/
|
|
30
|
-
clientBehavior?: typeof WhenClientSide[keyof typeof WhenClientSide];
|
|
30
|
+
clientBehavior?: (typeof WhenClientSide)[keyof typeof WhenClientSide];
|
|
31
31
|
/**
|
|
32
32
|
* When true, the children will be rendered with the existing result
|
|
33
33
|
* until the pending load is completed. Otherwise, the children will be
|
package/dist/es/index.js
CHANGED
|
@@ -36,7 +36,7 @@ class DataError extends KindError {
|
|
|
36
36
|
|
|
37
37
|
class ScopedInMemoryCache {
|
|
38
38
|
constructor(initialCache = {}) {
|
|
39
|
-
this._cache =
|
|
39
|
+
this._cache = undefined;
|
|
40
40
|
this._cache = initialCache;
|
|
41
41
|
}
|
|
42
42
|
get inUse() {
|
|
@@ -58,7 +58,7 @@ class ScopedInMemoryCache {
|
|
|
58
58
|
}
|
|
59
59
|
get(scope, id) {
|
|
60
60
|
var _this$_cache$scope$id, _this$_cache$scope2;
|
|
61
|
-
return (_this$_cache$scope$id = (_this$_cache$scope2 = this._cache[scope]) == null ?
|
|
61
|
+
return (_this$_cache$scope$id = (_this$_cache$scope2 = this._cache[scope]) == null ? undefined : _this$_cache$scope2[id]) != null ? _this$_cache$scope$id : null;
|
|
62
62
|
}
|
|
63
63
|
purge(scope, id) {
|
|
64
64
|
var _this$_cache$scope3;
|
|
@@ -130,8 +130,8 @@ class SsrCache {
|
|
|
130
130
|
return _default$2;
|
|
131
131
|
}
|
|
132
132
|
constructor(hydrationCache = null, ssrOnlyCache = null) {
|
|
133
|
-
this._hydrationCache =
|
|
134
|
-
this._ssrOnlyCache =
|
|
133
|
+
this._hydrationCache = undefined;
|
|
134
|
+
this._ssrOnlyCache = undefined;
|
|
135
135
|
this.initialize = source => {
|
|
136
136
|
if (this._hydrationCache.inUse) {
|
|
137
137
|
throw new Error("Cannot initialize data response cache more than once");
|
|
@@ -249,8 +249,8 @@ class RequestTracker {
|
|
|
249
249
|
}
|
|
250
250
|
constructor(responseCache) {
|
|
251
251
|
this._trackedRequests = {};
|
|
252
|
-
this._responseCache =
|
|
253
|
-
this._requestFulfillment =
|
|
252
|
+
this._responseCache = undefined;
|
|
253
|
+
this._requestFulfillment = undefined;
|
|
254
254
|
this.trackDataRequest = (id, handler, hydrate) => {
|
|
255
255
|
if (this._trackedRequests[id] == null) {
|
|
256
256
|
this._trackedRequests[id] = {
|
|
@@ -428,7 +428,7 @@ const useServerEffect = (requestId, handler, options = {}) => {
|
|
|
428
428
|
const cachedResult = SsrCache.Default.getEntry(requestId);
|
|
429
429
|
const maybeTrack = useContext(TrackerContext);
|
|
430
430
|
if (!skip && cachedResult == null && Server.isServerSide()) {
|
|
431
|
-
maybeTrack == null
|
|
431
|
+
maybeTrack == null || maybeTrack(requestId, interceptedHandler, hydrate);
|
|
432
432
|
}
|
|
433
433
|
return cachedResult == null ? null : resultFromCachedResponse(cachedResult);
|
|
434
434
|
};
|
|
@@ -450,7 +450,7 @@ const useCachedEffect = (requestId, handler, options = {}) => {
|
|
|
450
450
|
const currentRequestRef = React.useRef();
|
|
451
451
|
const fetchRequest = React.useMemo(() => {
|
|
452
452
|
var _currentRequestRef$cu;
|
|
453
|
-
(_currentRequestRef$cu = currentRequestRef.current) == null
|
|
453
|
+
(_currentRequestRef$cu = currentRequestRef.current) == null || _currentRequestRef$cu.cancel();
|
|
454
454
|
currentRequestRef.current = null;
|
|
455
455
|
networkResultRef.current = null;
|
|
456
456
|
const fetchFn = () => {
|
|
@@ -461,11 +461,11 @@ const useCachedEffect = (requestId, handler, options = {}) => {
|
|
|
461
461
|
const request = RequestFulfillment.Default.fulfill(`${requestId}|${scope}`, {
|
|
462
462
|
handler: interceptedHandler
|
|
463
463
|
});
|
|
464
|
-
if (request === ((_currentRequestRef$cu2 = currentRequestRef.current) == null ?
|
|
464
|
+
if (request === ((_currentRequestRef$cu2 = currentRequestRef.current) == null ? undefined : _currentRequestRef$cu2.request)) {
|
|
465
465
|
return;
|
|
466
466
|
}
|
|
467
467
|
networkResultRef.current = null;
|
|
468
|
-
(_currentRequestRef$cu3 = currentRequestRef.current) == null
|
|
468
|
+
(_currentRequestRef$cu3 = currentRequestRef.current) == null || _currentRequestRef$cu3.cancel();
|
|
469
469
|
let cancel = false;
|
|
470
470
|
request.then(result => {
|
|
471
471
|
currentRequestRef.current = null;
|
|
@@ -513,7 +513,7 @@ const useCachedEffect = (requestId, handler, options = {}) => {
|
|
|
513
513
|
fetchRequest();
|
|
514
514
|
return () => {
|
|
515
515
|
var _currentRequestRef$cu4;
|
|
516
|
-
(_currentRequestRef$cu4 = currentRequestRef.current) == null
|
|
516
|
+
(_currentRequestRef$cu4 = currentRequestRef.current) == null || _currentRequestRef$cu4.cancel();
|
|
517
517
|
currentRequestRef.current = null;
|
|
518
518
|
};
|
|
519
519
|
}, [shouldFetch, fetchRequest]);
|
|
@@ -552,7 +552,7 @@ const useHydratableEffect = (requestId, handler, options = {}) => {
|
|
|
552
552
|
case WhenClientSide.ExecuteWhenNoResult:
|
|
553
553
|
return serverResult;
|
|
554
554
|
case WhenClientSide.ExecuteWhenNoSuccessResult:
|
|
555
|
-
if ((serverResult == null ?
|
|
555
|
+
if ((serverResult == null ? undefined : serverResult.status) === "success") {
|
|
556
556
|
return serverResult;
|
|
557
557
|
}
|
|
558
558
|
return null;
|
|
@@ -745,7 +745,7 @@ function graphQLDocumentNodeParser(document) {
|
|
|
745
745
|
const definitions = queries.length ? queries : mutations;
|
|
746
746
|
const definition = definitions[0];
|
|
747
747
|
const variables = definition.variableDefinitions || [];
|
|
748
|
-
const name = ((_definition$name = definition.name) == null ?
|
|
748
|
+
const name = ((_definition$name = definition.name) == null ? undefined : _definition$name.kind) === "Name" ? definition.name.value : "data";
|
|
749
749
|
const payload = {
|
|
750
750
|
name,
|
|
751
751
|
type,
|
|
@@ -7,7 +7,7 @@ type CachedEffectOptions<TData extends ValidCacheData> = {
|
|
|
7
7
|
*
|
|
8
8
|
* Defaults to `FetchPolicy.CacheBeforeNetwork`.
|
|
9
9
|
*/
|
|
10
|
-
fetchPolicy?: typeof FetchPolicy[keyof typeof FetchPolicy];
|
|
10
|
+
fetchPolicy?: (typeof FetchPolicy)[keyof typeof FetchPolicy];
|
|
11
11
|
/**
|
|
12
12
|
* When `true`, the effect will not be executed; otherwise, the effect will
|
|
13
13
|
* be executed.
|
|
@@ -45,7 +45,7 @@ type HydratableEffectOptions<TData extends ValidCacheData> = {
|
|
|
45
45
|
* Changing this value after the first call is irrelevant as it only
|
|
46
46
|
* affects the initial render behavior.
|
|
47
47
|
*/
|
|
48
|
-
clientBehavior?: typeof WhenClientSide[keyof typeof WhenClientSide];
|
|
48
|
+
clientBehavior?: (typeof WhenClientSide)[keyof typeof WhenClientSide];
|
|
49
49
|
/**
|
|
50
50
|
* When `true`, the effect will not be executed; otherwise, the effect will
|
|
51
51
|
* be executed.
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var wonderBlocksCore = require('@khanacademy/wonder-blocks-core');
|
|
6
4
|
var wonderStuffCore = require('@khanacademy/wonder-stuff-core');
|
|
7
5
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
8
6
|
var React = require('react');
|
|
9
7
|
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
function _interopNamespace(e) {
|
|
13
|
-
if (e && e.__esModule) return e;
|
|
8
|
+
function _interopNamespaceDefault(e) {
|
|
14
9
|
var n = Object.create(null);
|
|
15
10
|
if (e) {
|
|
16
11
|
Object.keys(e).forEach(function (k) {
|
|
@@ -23,12 +18,11 @@ function _interopNamespace(e) {
|
|
|
23
18
|
}
|
|
24
19
|
});
|
|
25
20
|
}
|
|
26
|
-
n
|
|
21
|
+
n.default = e;
|
|
27
22
|
return Object.freeze(n);
|
|
28
23
|
}
|
|
29
24
|
|
|
30
|
-
var
|
|
31
|
-
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
25
|
+
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
32
26
|
|
|
33
27
|
let FetchPolicy = function (FetchPolicy) {
|
|
34
28
|
FetchPolicy["CacheBeforeNetwork"] = "CacheBeforeNetwork";
|
|
@@ -62,7 +56,7 @@ class DataError extends wonderStuffCore.KindError {
|
|
|
62
56
|
|
|
63
57
|
class ScopedInMemoryCache {
|
|
64
58
|
constructor(initialCache = {}) {
|
|
65
|
-
this._cache =
|
|
59
|
+
this._cache = undefined;
|
|
66
60
|
this._cache = initialCache;
|
|
67
61
|
}
|
|
68
62
|
get inUse() {
|
|
@@ -84,7 +78,7 @@ class ScopedInMemoryCache {
|
|
|
84
78
|
}
|
|
85
79
|
get(scope, id) {
|
|
86
80
|
var _this$_cache$scope$id, _this$_cache$scope2;
|
|
87
|
-
return (_this$_cache$scope$id = (_this$_cache$scope2 = this._cache[scope]) == null ?
|
|
81
|
+
return (_this$_cache$scope$id = (_this$_cache$scope2 = this._cache[scope]) == null ? undefined : _this$_cache$scope2[id]) != null ? _this$_cache$scope$id : null;
|
|
88
82
|
}
|
|
89
83
|
purge(scope, id) {
|
|
90
84
|
var _this$_cache$scope3;
|
|
@@ -156,8 +150,8 @@ class SsrCache {
|
|
|
156
150
|
return _default$2;
|
|
157
151
|
}
|
|
158
152
|
constructor(hydrationCache = null, ssrOnlyCache = null) {
|
|
159
|
-
this._hydrationCache =
|
|
160
|
-
this._ssrOnlyCache =
|
|
153
|
+
this._hydrationCache = undefined;
|
|
154
|
+
this._ssrOnlyCache = undefined;
|
|
161
155
|
this.initialize = source => {
|
|
162
156
|
if (this._hydrationCache.inUse) {
|
|
163
157
|
throw new Error("Cannot initialize data response cache more than once");
|
|
@@ -275,8 +269,8 @@ class RequestTracker {
|
|
|
275
269
|
}
|
|
276
270
|
constructor(responseCache) {
|
|
277
271
|
this._trackedRequests = {};
|
|
278
|
-
this._responseCache =
|
|
279
|
-
this._requestFulfillment =
|
|
272
|
+
this._responseCache = undefined;
|
|
273
|
+
this._requestFulfillment = undefined;
|
|
280
274
|
this.trackDataRequest = (id, handler, hydrate) => {
|
|
281
275
|
if (this._trackedRequests[id] == null) {
|
|
282
276
|
this._trackedRequests[id] = {
|
|
@@ -297,7 +291,7 @@ class RequestTracker {
|
|
|
297
291
|
for (const requestKey of Object.keys(this._trackedRequests)) {
|
|
298
292
|
const options = this._trackedRequests[requestKey];
|
|
299
293
|
try {
|
|
300
|
-
promises.push(this._requestFulfillment.fulfill(requestKey,
|
|
294
|
+
promises.push(this._requestFulfillment.fulfill(requestKey, _extends({}, options)).then(result => {
|
|
301
295
|
switch (result.status) {
|
|
302
296
|
case "success":
|
|
303
297
|
cacheData(requestKey, result.data, options.hydrate);
|
|
@@ -454,7 +448,7 @@ const useServerEffect = (requestId, handler, options = {}) => {
|
|
|
454
448
|
const cachedResult = SsrCache.Default.getEntry(requestId);
|
|
455
449
|
const maybeTrack = React.useContext(TrackerContext);
|
|
456
450
|
if (!skip && cachedResult == null && wonderBlocksCore.Server.isServerSide()) {
|
|
457
|
-
maybeTrack == null
|
|
451
|
+
maybeTrack == null || maybeTrack(requestId, interceptedHandler, hydrate);
|
|
458
452
|
}
|
|
459
453
|
return cachedResult == null ? null : resultFromCachedResponse(cachedResult);
|
|
460
454
|
};
|
|
@@ -476,7 +470,7 @@ const useCachedEffect = (requestId, handler, options = {}) => {
|
|
|
476
470
|
const currentRequestRef = React__namespace.useRef();
|
|
477
471
|
const fetchRequest = React__namespace.useMemo(() => {
|
|
478
472
|
var _currentRequestRef$cu;
|
|
479
|
-
(_currentRequestRef$cu = currentRequestRef.current) == null
|
|
473
|
+
(_currentRequestRef$cu = currentRequestRef.current) == null || _currentRequestRef$cu.cancel();
|
|
480
474
|
currentRequestRef.current = null;
|
|
481
475
|
networkResultRef.current = null;
|
|
482
476
|
const fetchFn = () => {
|
|
@@ -487,11 +481,11 @@ const useCachedEffect = (requestId, handler, options = {}) => {
|
|
|
487
481
|
const request = RequestFulfillment.Default.fulfill(`${requestId}|${scope}`, {
|
|
488
482
|
handler: interceptedHandler
|
|
489
483
|
});
|
|
490
|
-
if (request === ((_currentRequestRef$cu2 = currentRequestRef.current) == null ?
|
|
484
|
+
if (request === ((_currentRequestRef$cu2 = currentRequestRef.current) == null ? undefined : _currentRequestRef$cu2.request)) {
|
|
491
485
|
return;
|
|
492
486
|
}
|
|
493
487
|
networkResultRef.current = null;
|
|
494
|
-
(_currentRequestRef$cu3 = currentRequestRef.current) == null
|
|
488
|
+
(_currentRequestRef$cu3 = currentRequestRef.current) == null || _currentRequestRef$cu3.cancel();
|
|
495
489
|
let cancel = false;
|
|
496
490
|
request.then(result => {
|
|
497
491
|
currentRequestRef.current = null;
|
|
@@ -539,7 +533,7 @@ const useCachedEffect = (requestId, handler, options = {}) => {
|
|
|
539
533
|
fetchRequest();
|
|
540
534
|
return () => {
|
|
541
535
|
var _currentRequestRef$cu4;
|
|
542
|
-
(_currentRequestRef$cu4 = currentRequestRef.current) == null
|
|
536
|
+
(_currentRequestRef$cu4 = currentRequestRef.current) == null || _currentRequestRef$cu4.cancel();
|
|
543
537
|
currentRequestRef.current = null;
|
|
544
538
|
};
|
|
545
539
|
}, [shouldFetch, fetchRequest]);
|
|
@@ -578,7 +572,7 @@ const useHydratableEffect = (requestId, handler, options = {}) => {
|
|
|
578
572
|
case WhenClientSide.ExecuteWhenNoResult:
|
|
579
573
|
return serverResult;
|
|
580
574
|
case WhenClientSide.ExecuteWhenNoSuccessResult:
|
|
581
|
-
if ((serverResult == null ?
|
|
575
|
+
if ((serverResult == null ? undefined : serverResult.status) === "success") {
|
|
582
576
|
return serverResult;
|
|
583
577
|
}
|
|
584
578
|
return null;
|
|
@@ -771,7 +765,7 @@ function graphQLDocumentNodeParser(document) {
|
|
|
771
765
|
const definitions = queries.length ? queries : mutations;
|
|
772
766
|
const definition = definitions[0];
|
|
773
767
|
const variables = definition.variableDefinitions || [];
|
|
774
|
-
const name = ((_definition$name = definition.name) == null ?
|
|
768
|
+
const name = ((_definition$name = definition.name) == null ? undefined : _definition$name.kind) === "Name" ? definition.name.value : "data";
|
|
775
769
|
const payload = {
|
|
776
770
|
name,
|
|
777
771
|
type,
|
|
@@ -817,7 +811,7 @@ const mergeGqlContext = (defaultContext, overrides) => {
|
|
|
817
811
|
}
|
|
818
812
|
}
|
|
819
813
|
return acc;
|
|
820
|
-
},
|
|
814
|
+
}, _extends({}, defaultContext));
|
|
821
815
|
};
|
|
822
816
|
|
|
823
817
|
const useGqlRouterContext = (contextOverrides = {}) => {
|
|
@@ -41,5 +41,5 @@ export declare const DataErrors: Readonly<{
|
|
|
41
41
|
* `${kind}DataError`
|
|
42
42
|
*/
|
|
43
43
|
export declare class DataError extends KindError {
|
|
44
|
-
constructor(message: string, kind: typeof DataErrors[keyof typeof DataErrors], { metadata, cause }?: ErrorOptions);
|
|
44
|
+
constructor(message: string, kind: (typeof DataErrors)[keyof typeof DataErrors], { metadata, cause }?: ErrorOptions);
|
|
45
45
|
}
|
package/dist/util/gql-error.d.ts
CHANGED
|
@@ -24,5 +24,5 @@ export declare const GqlErrors: Readonly<{
|
|
|
24
24
|
* `${kind}GqlError`
|
|
25
25
|
*/
|
|
26
26
|
export declare class GqlError extends KindError {
|
|
27
|
-
constructor(message: string, kind: typeof GqlErrors[keyof typeof GqlErrors], { metadata, cause }?: ErrorOptions);
|
|
27
|
+
constructor(message: string, kind: (typeof GqlErrors)[keyof typeof GqlErrors], { metadata, cause }?: ErrorOptions);
|
|
28
28
|
}
|
|
@@ -3,7 +3,7 @@ export declare const DocumentTypes: Readonly<{
|
|
|
3
3
|
query: "query";
|
|
4
4
|
mutation: "mutation";
|
|
5
5
|
}>;
|
|
6
|
-
export type DocumentType = typeof DocumentTypes[keyof typeof DocumentTypes];
|
|
6
|
+
export type DocumentType = (typeof DocumentTypes)[keyof typeof DocumentTypes];
|
|
7
7
|
export interface IDocumentDefinition {
|
|
8
8
|
type: DocumentType;
|
|
9
9
|
name: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-data",
|
|
3
|
-
"version": "14.0
|
|
3
|
+
"version": "14.1.0",
|
|
4
4
|
"design": "v1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -9,23 +9,22 @@
|
|
|
9
9
|
"main": "dist/index.js",
|
|
10
10
|
"module": "dist/es/index.js",
|
|
11
11
|
"types": "dist/index.d.ts",
|
|
12
|
-
"scripts": {
|
|
13
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
14
|
-
"prepublishOnly": "../../utils/publish/package-pre-publish-check.sh"
|
|
15
|
-
},
|
|
16
12
|
"dependencies": {
|
|
17
|
-
"@babel/runtime": "^7.
|
|
18
|
-
"@khanacademy/wonder-blocks-core": "
|
|
13
|
+
"@babel/runtime": "^7.24.5",
|
|
14
|
+
"@khanacademy/wonder-blocks-core": "12.1.0"
|
|
19
15
|
},
|
|
20
16
|
"peerDependencies": {
|
|
21
|
-
"@khanacademy/wonder-stuff-core": "^1.
|
|
17
|
+
"@khanacademy/wonder-stuff-core": "^1.5.4",
|
|
22
18
|
"react": "18.2.0"
|
|
23
19
|
},
|
|
24
20
|
"devDependencies": {
|
|
25
|
-
"@khanacademy/
|
|
26
|
-
"@khanacademy/
|
|
27
|
-
"@khanacademy/wonder-blocks-testing-core": "
|
|
21
|
+
"@khanacademy/wonder-stuff-testing": "^3.0.5",
|
|
22
|
+
"@khanacademy/wb-dev-build-settings": "2.1.0",
|
|
23
|
+
"@khanacademy/wonder-blocks-testing-core": "2.1.0"
|
|
28
24
|
},
|
|
29
25
|
"author": "",
|
|
30
|
-
"license": "MIT"
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"scripts": {
|
|
28
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
29
|
+
}
|
|
31
30
|
}
|