Skip to content

Commit

Permalink
fix: @sharable is applied multiple times on PageInfo in multithreaded…
Browse files Browse the repository at this point in the history
… environments
  • Loading branch information
mak626 committed Apr 22, 2024
1 parent bee1ded commit 3e4013b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions graphene_federation/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,13 @@ def _add_sharable_to_page_info_type(
"""
Add @sharable directive to PageInfo type
"""
if PageInfo.__name__ in schema.graphql_schema.type_map:

if page_info := schema.graphql_schema.type_map.get(PageInfo.__name__):
try:
# PageInfo needs @sharable directive
sharable = get_directive_from_name("shareable", federation_version)
types.append(
directive_decorator(target_directive=sharable)(field=None)(PageInfo)
directive_decorator(target_directive=sharable)(field=None)(page_info)
)
except ValueError:
# Federation Version does not support @sharable
Expand Down

0 comments on commit 3e4013b

Please sign in to comment.