|
95 | 95 | from strawberry.types.scalar import ScalarDefinition, ScalarWrapper |
96 | 96 | from strawberry.types.union import StrawberryUnion |
97 | 97 |
|
| 98 | + |
98 | 99 | SubscriptionResult: TypeAlias = AsyncGenerator[ |
99 | 100 | PreExecutionError | ExecutionResult, None |
100 | 101 | ] |
@@ -398,12 +399,18 @@ def create_extensions_runner( |
398 | 399 | ) |
399 | 400 |
|
400 | 401 | def _get_custom_context_kwargs( |
401 | | - self, operation_extensions: dict[str, Any] | None = None |
| 402 | + self, |
| 403 | + operation_extensions: dict[str, Any] | None = None, |
| 404 | + *, |
| 405 | + sync: bool = False, |
402 | 406 | ) -> dict[str, Any]: |
403 | 407 | if not IS_GQL_33: |
404 | 408 | return {} |
405 | 409 |
|
406 | | - return {"operation_extensions": operation_extensions} |
| 410 | + kwargs: dict[str, Any] = {"operation_extensions": operation_extensions} |
| 411 | + if sync: |
| 412 | + kwargs["is_async_iterable"] = lambda _x: False |
| 413 | + return kwargs |
407 | 414 |
|
408 | 415 | def _get_middleware_manager( |
409 | 416 | self, extensions: list[SchemaExtension], *, cached: bool = True |
@@ -705,7 +712,9 @@ def execute_sync( |
705 | 712 | "Incremental execution is enabled but experimental_execute_incrementally is not available, " |
706 | 713 | "please install graphql-core>=3.3.0" |
707 | 714 | ) |
708 | | - custom_context_kwargs = self._get_custom_context_kwargs(operation_extensions) |
| 715 | + custom_context_kwargs = self._get_custom_context_kwargs( |
| 716 | + operation_extensions, sync=True |
| 717 | + ) |
709 | 718 |
|
710 | 719 | try: |
711 | 720 | with extensions_runner.operation(): |
|
0 commit comments