@khanacademy/wonder-blocks-data 3.1.0 → 3.1.1
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 +6 -0
- package/dist/es/index.js +4 -1
- package/dist/index.js +4 -1
- package/package.json +1 -1
- package/src/components/gql-router.js +2 -2
- package/src/hooks/use-gql.js +2 -0
- package/src/index.js +7 -1
- package/src/util/gql-types.js +7 -2
package/CHANGELOG.md
CHANGED
package/dist/es/index.js
CHANGED
|
@@ -897,7 +897,10 @@ const useGql = () => {
|
|
|
897
897
|
// Even then, it's reliant on the fetch supporting aborts.
|
|
898
898
|
if (error.name === "AbortError") {
|
|
899
899
|
return null;
|
|
900
|
-
}
|
|
900
|
+
} // Need to make sure we pass other errors along.
|
|
901
|
+
|
|
902
|
+
|
|
903
|
+
throw error;
|
|
901
904
|
});
|
|
902
905
|
}, [fetch, defaultContext]);
|
|
903
906
|
return gqlFetch;
|
package/dist/index.js
CHANGED
|
@@ -1066,7 +1066,10 @@ const useGql = () => {
|
|
|
1066
1066
|
// Even then, it's reliant on the fetch supporting aborts.
|
|
1067
1067
|
if (error.name === "AbortError") {
|
|
1068
1068
|
return null;
|
|
1069
|
-
}
|
|
1069
|
+
} // Need to make sure we pass other errors along.
|
|
1070
|
+
|
|
1071
|
+
|
|
1072
|
+
throw error;
|
|
1070
1073
|
});
|
|
1071
1074
|
}, [fetch, defaultContext]);
|
|
1072
1075
|
return gqlFetch;
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ import {GqlRouterContext} from "../util/gql-router-context.js";
|
|
|
5
5
|
|
|
6
6
|
import type {
|
|
7
7
|
GqlContext,
|
|
8
|
-
|
|
8
|
+
GqlFetchFn,
|
|
9
9
|
GqlRouterConfiguration,
|
|
10
10
|
} from "../util/gql-types.js";
|
|
11
11
|
|
|
@@ -18,7 +18,7 @@ type Props<TContext: GqlContext> = {|
|
|
|
18
18
|
/**
|
|
19
19
|
* The function to use when fetching requests.
|
|
20
20
|
*/
|
|
21
|
-
fetch:
|
|
21
|
+
fetch: GqlFetchFn<any, any, any, TContext>,
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* The children to be rendered inside the router.
|
package/src/hooks/use-gql.js
CHANGED
package/src/index.js
CHANGED
|
@@ -60,4 +60,10 @@ export {useData} from "./hooks/use-data.js";
|
|
|
60
60
|
export {GqlRouter} from "./components/gql-router.js";
|
|
61
61
|
export {useGql} from "./hooks/use-gql.js";
|
|
62
62
|
export * from "./util/gql-error.js";
|
|
63
|
-
export type {
|
|
63
|
+
export type {
|
|
64
|
+
GqlContext,
|
|
65
|
+
GqlOperation,
|
|
66
|
+
GqlOperationType,
|
|
67
|
+
GqlFetchOptions,
|
|
68
|
+
GqlFetchFn,
|
|
69
|
+
} from "./util/gql-types.js";
|
package/src/util/gql-types.js
CHANGED
|
@@ -37,7 +37,12 @@ export type GqlContext = {|
|
|
|
37
37
|
/**
|
|
38
38
|
* Functions that make fetches of GQL operations.
|
|
39
39
|
*/
|
|
40
|
-
export type
|
|
40
|
+
export type GqlFetchFn<
|
|
41
|
+
TType,
|
|
42
|
+
TData,
|
|
43
|
+
TVariables: {...},
|
|
44
|
+
TContext: GqlContext,
|
|
45
|
+
> = (
|
|
41
46
|
operation: GqlOperation<TType, TData, TVariables>,
|
|
42
47
|
variables: ?TVariables,
|
|
43
48
|
context: TContext,
|
|
@@ -47,7 +52,7 @@ export type FetchFn<TType, TData, TVariables: {...}, TContext: GqlContext> = (
|
|
|
47
52
|
* The configuration stored in the GqlRouterContext context.
|
|
48
53
|
*/
|
|
49
54
|
export type GqlRouterConfiguration<TContext: GqlContext> = {|
|
|
50
|
-
fetch:
|
|
55
|
+
fetch: GqlFetchFn<any, any, any, any>,
|
|
51
56
|
defaultContext: TContext,
|
|
52
57
|
|};
|
|
53
58
|
|