graphql-python / graphql-python/graphene-django

convert_field_to_djangomodel's wrap_resolve for `ForeignKey` and `OneToOneField` is not Promise or Future aware

Open
#1,358 3 comments 1 reaction 0 assignees View on GitHub
🐛bug
Dominant language
Python
Stars
4.4k
Forks
760
PR merge metrics
No merged PRs in 30d

Description

**Note: for support questions, please use stackoverflow**. This repository's issues are reserved for feature requests and bug reports.

* **What is the current behavior?**
The`wrap_resolve` function that wraps around an original resolver function assumes the returned value is a concrete value instead of a Promise or Future-like object. This breaks the usage with any dataloaders.

I consider this an issue because the project as a whole is still promise-aware (see the debugger middleware and https://github.com/graphql-python/graphene-django/blob/main/graphene_django/fields.py#L241)

* **If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem** via
a github repo, https://repl.it or similar (you can use this template as a starting point: https://repl.it/@jkimbo/Graphene-Django-Example).

* **What is the expected behavior?**
It should automatically handle the case where the returned value is a Promise just as other places in the code

* **What is the motivation / use case for changing the behavior?**
It prevents all dataloaders from working

* **Please tell us about your environment:**

- Version: 3.0.0
- Platform:

* **Other information** (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow)
I know this would not solve the issue where people opt to use non-prpmise based dataloaders, but it should be consistent with other places in the code.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.