File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,10 @@ import type {
25
25
type mutationFn = ( object : Object , info : GraphQLResolveInfo) => Object |
26
26
( object : Object , info : GraphQLResolveInfo) => Promise < Object > ;
27
27
28
+ function resolveMaybeThunk < T > (thingOrThunk: T | () => T ) : T {
29
+ return typeof thingOrThunk === 'function' ? thingOrThunk ( ) : thingOrThunk ;
30
+ }
31
+
28
32
/**
29
33
* A description of a mutation consumable by mutationWithClientMutationId
30
34
* to create a GraphQLFieldConfig for that mutation.
@@ -55,13 +59,13 @@ export function mutationWithClientMutationId(
55
59
) : GraphQLFieldConfig {
56
60
var { name, inputFields, outputFields, mutateAndGetPayload} = config ;
57
61
var augmentedInputFields = {
58
- ...inputFields ,
62
+ ...resolveMaybeThunk ( inputFields ) ,
59
63
clientMutationId : {
60
64
type : new GraphQLNonNull ( GraphQLString )
61
65
}
62
66
} ;
63
67
var augmentedOutputFields = {
64
- ...outputFields ,
68
+ ...resolveMaybeThunk ( outputFields ) ,
65
69
clientMutationId : {
66
70
type : new GraphQLNonNull ( GraphQLString )
67
71
}
You can’t perform that action at this time.
0 commit comments