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
|
||||
from collections import OrderedDict
|
||||
|
||||
from promise import Promise
|
||||
from promise import Promise, is_thenable
|
||||
|
||||
from ..types import Field, InputObjectType, String
|
||||
from ..types.mutation import Mutation
|
||||
|
@ -61,5 +61,8 @@ class ClientIDMutation(Mutation):
|
|||
).format(repr(payload)))
|
||||
return payload
|
||||
|
||||
return Promise.resolve(
|
||||
cls.mutate_and_get_payload(input, context, info)).then(on_resolve)
|
||||
result = cls.mutate_and_get_payload(input, context, info)
|
||||
if is_thenable(result):
|
||||
return Promise.resolve(result).then(on_resolve)
|
||||
|
||||
return on_resolve(result)
|
||||
|
|
Loading…
Reference in New Issue
Block a user