Skip to content

Commit 9fc3391

Browse files
committed
fix: @sharable is applied multiple times on PageInfo in multithreaded environments
1 parent bee1ded commit 9fc3391

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

graphene_federation/schema.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,15 @@ def _add_sharable_to_page_info_type(
4848
"""
4949
Add @sharable directive to PageInfo type
5050
"""
51-
if PageInfo.__name__ in schema.graphql_schema.type_map:
51+
52+
if page_info := schema.graphql_schema.type_map.get(PageInfo.__name__):
5253
try:
5354
# PageInfo needs @sharable directive
5455
sharable = get_directive_from_name("shareable", federation_version)
5556
types.append(
56-
directive_decorator(target_directive=sharable)(field=None)(PageInfo)
57+
directive_decorator(target_directive=sharable)(field=None)(
58+
page_info.graphene_type
59+
)
5760
)
5861
except ValueError:
5962
# Federation Version does not support @sharable

0 commit comments

Comments
 (0)