mirror of
https://github.com/graphql-python/graphene.git
synced 2025-03-05 20:35:46 +03:00
Improved mutation with thenable check
This commit is contained in:
parent
b892eee0ae
commit
b185f4cae7
|
@ -1,7 +1,7 @@
|
||||||
import re
|
import re
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
from promise import Promise
|
from promise import Promise, is_thenable
|
||||||
|
|
||||||
from ..types import Field, InputObjectType, String
|
from ..types import Field, InputObjectType, String
|
||||||
from ..types.mutation import Mutation
|
from ..types.mutation import Mutation
|
||||||
|
@ -60,6 +60,9 @@ class ClientIDMutation(Mutation):
|
||||||
('Cannot set client_mutation_id in the payload object {}'
|
('Cannot set client_mutation_id in the payload object {}'
|
||||||
).format(repr(payload)))
|
).format(repr(payload)))
|
||||||
return payload
|
return payload
|
||||||
|
|
||||||
return Promise.resolve(
|
result = cls.mutate_and_get_payload(input, context, info)
|
||||||
cls.mutate_and_get_payload(input, context, info)).then(on_resolve)
|
if is_thenable(result):
|
||||||
|
return Promise.resolve(result).then(on_resolve)
|
||||||
|
|
||||||
|
return on_resolve(result)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user