Skip to content

Commit

Permalink
fix graphql resolve off empty store
Browse files Browse the repository at this point in the history
  • Loading branch information
dwsutherland committed Oct 7, 2021
1 parent c39251f commit af5eb49
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions cylc/flow/network/graphql.py
Expand Up @@ -407,6 +407,22 @@ def resolve(self, next_, root, info, **args):
parent_path_string]['fields']
):
return None
# Do not resolve subfields of an empty type
# by setting as null in parent/root.
elif (
isinstance(root, dict)
and field_name in root
):
field_value = root[field_name]
if (
field_value in EMPTY_VALUES
or (
hasattr(field_value, 'ListFields')
and not field_value.ListFields()
)
):
root[field_name] = None
return None
if (
info.operation.operation in self.ASYNC_OPS
or iscoroutinefunction(next_)
Expand Down

0 comments on commit af5eb49

Please sign in to comment.