@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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @khanacademy/wonder-blocks-data
2
2
 
3
+ ## 3.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 4ff59815: Add GraphQL fetch mock support to wonder-blocks-testing
8
+
3
9
  ## 3.1.0
4
10
 
5
11
  ### Minor Changes
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@khanacademy/wonder-blocks-data",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "design": "v1",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -5,7 +5,7 @@ import {GqlRouterContext} from "../util/gql-router-context.js";
5
5
 
6
6
  import type {
7
7
  GqlContext,
8
- FetchFn,
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: FetchFn<any, any, any, TContext>,
21
+ fetch: GqlFetchFn<any, any, any, TContext>,
22
22
 
23
23
  /**
24
24
  * The children to be rendered inside the router.
@@ -67,6 +67,8 @@ export const useGql = (): (<
67
67
  if (error.name === "AbortError") {
68
68
  return null;
69
69
  }
70
+ // Need to make sure we pass other errors along.
71
+ throw error;
70
72
  });
71
73
  },
72
74
  [fetch, defaultContext],
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 {GqlContext, GqlOperation} from "./util/gql-types.js";
63
+ export type {
64
+ GqlContext,
65
+ GqlOperation,
66
+ GqlOperationType,
67
+ GqlFetchOptions,
68
+ GqlFetchFn,
69
+ } from "./util/gql-types.js";
@@ -37,7 +37,12 @@ export type GqlContext = {|
37
37
  /**
38
38
  * Functions that make fetches of GQL operations.
39
39
  */
40
- export type FetchFn<TType, TData, TVariables: {...}, TContext: GqlContext> = (
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: FetchFn<any, any, any, any>,
55
+ fetch: GqlFetchFn<any, any, any, any>,
51
56
  defaultContext: TContext,
52
57
  |};
53
58