@khanacademy/wonder-blocks-data 2.3.3 → 2.3.4
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-data",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.4",
|
|
4
4
|
"design": "v1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -13,16 +13,16 @@
|
|
|
13
13
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@babel/runtime": "^7.
|
|
17
|
-
"@khanacademy/wonder-blocks-core": "^
|
|
16
|
+
"@babel/runtime": "^7.16.3",
|
|
17
|
+
"@khanacademy/wonder-blocks-core": "^4.0.0"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"react": "16.14.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"wb-dev-build-settings": "^0.
|
|
23
|
+
"wb-dev-build-settings": "^0.2.0"
|
|
24
24
|
},
|
|
25
25
|
"author": "",
|
|
26
26
|
"license": "MIT",
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "9ebea88533e702011165072f090a377e02fa3f0f"
|
|
28
28
|
}
|
package/src/components/data.js
CHANGED
|
@@ -132,12 +132,10 @@ export default class Data<TOptions, TData: ValidData> extends React.Component<
|
|
|
132
132
|
{(value) => {
|
|
133
133
|
const handlerType = this.props.handler.type;
|
|
134
134
|
const interceptor = value[handlerType];
|
|
135
|
-
const handler =
|
|
136
|
-
interceptor
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
interceptor,
|
|
140
|
-
);
|
|
135
|
+
const handler =
|
|
136
|
+
this._getHandlerFromInterceptor(interceptor);
|
|
137
|
+
const getEntry =
|
|
138
|
+
this._getCacheLookupFnFromInterceptor(interceptor);
|
|
141
139
|
|
|
142
140
|
/**
|
|
143
141
|
* Need to share our types with InternalData so Flow
|
|
@@ -8,8 +8,7 @@ import type {InterceptContextData} from "../util/types.js";
|
|
|
8
8
|
*
|
|
9
9
|
* INTERNAL USE ONLY
|
|
10
10
|
*/
|
|
11
|
-
const InterceptContext: React.Context<InterceptContextData> =
|
|
12
|
-
{}
|
|
13
|
-
);
|
|
11
|
+
const InterceptContext: React.Context<InterceptContextData> =
|
|
12
|
+
React.createContext<InterceptContextData>({});
|
|
14
13
|
|
|
15
14
|
export default InterceptContext;
|
package/src/util/memory-cache.js
CHANGED
|
@@ -30,7 +30,8 @@ function deepClone<T: {...}>(source: T | $ReadOnly<T>): $ReadOnly<T> {
|
|
|
30
30
|
* absence of a custom cache. We use this for SSR too (see ./response-cache.js).
|
|
31
31
|
*/
|
|
32
32
|
export default class MemoryCache<TOptions, TData: ValidData>
|
|
33
|
-
implements ICache<TOptions, TData>
|
|
33
|
+
implements ICache<TOptions, TData>
|
|
34
|
+
{
|
|
34
35
|
_cache: Cache;
|
|
35
36
|
|
|
36
37
|
constructor(source: ?$ReadOnly<Cache> = null) {
|
package/src/util/no-cache.js
CHANGED
|
@@ -14,7 +14,8 @@ let defaultInstance: ?ICache<any, any> = null;
|
|
|
14
14
|
* requested data after hydration has finished.
|
|
15
15
|
*/
|
|
16
16
|
export default class NoCache<TOptions, TData: ValidData>
|
|
17
|
-
implements ICache<TOptions, TData>
|
|
17
|
+
implements ICache<TOptions, TData>
|
|
18
|
+
{
|
|
18
19
|
static get Default(): ICache<TOptions, TData> {
|
|
19
20
|
if (defaultInstance == null) {
|
|
20
21
|
defaultInstance = new NoCache<TOptions, TData>();
|
|
@@ -8,7 +8,8 @@ import type {ValidData, CacheEntry, IRequestHandler, ICache} from "./types.js";
|
|
|
8
8
|
* use with the Wonder Blocks Data framework.
|
|
9
9
|
*/
|
|
10
10
|
export default class RequestHandler<TOptions, TData: ValidData>
|
|
11
|
-
implements IRequestHandler<TOptions, TData>
|
|
11
|
+
implements IRequestHandler<TOptions, TData>
|
|
12
|
+
{
|
|
12
13
|
_type: string;
|
|
13
14
|
_cache: ?ICache<TOptions, TData>;
|
|
14
15
|
_hydrate: boolean;
|
|
@@ -25,9 +25,8 @@ type RequestCache = {
|
|
|
25
25
|
*
|
|
26
26
|
* INTERNAL USE ONLY
|
|
27
27
|
*/
|
|
28
|
-
export const TrackerContext: React.Context<?TrackerFn> =
|
|
29
|
-
null
|
|
30
|
-
);
|
|
28
|
+
export const TrackerContext: React.Context<?TrackerFn> =
|
|
29
|
+
new React.createContext<?TrackerFn>(null);
|
|
31
30
|
|
|
32
31
|
/**
|
|
33
32
|
* The default instance is stored here.
|