convert_field_to_djangomodel's wrap_resolve for `ForeignKey` and `OneToOneField` is not Promise or Future aware
ericls opened this issue · comments
Note: for support questions, please use stackoverflow. This repository's issues are reserved for feature requests and bug reports.
- What is the current behavior?
Thewrap_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.
In fact it also assumes the fk_obj is retrieved by pk, but it's not always the case. I guess the recommended action here is just to not use the auto generated fields for these?
@erikwrede @firaskafri do you have any insights if we are planning to solve this 🙏🏼?
@ericls did you manage to find a workaround for this or you had to write new dataloaders to load the FK fields?