Including `id` field in query aborts "only" optimization
See original GitHub issueIn my API I have a type which is based on Django’s model using DjangoObjectType
and relay.Node
interface. Using the latter automatically adds the id
(graphene.ID
) field in the type.
class Product(DjangoObjectType):
name = graphene.String()
class Meta:
interfaces = [relay.Node]
model = models.Product
Now, when I query the API (with optimizer enabled) and include the id
field in the query, the “only optimization” is aborted as a result of this check - my automatically added id
field has no name. As a result, this function is called which sets the only_list
to None
and disables any future “only optimizations” I’d have in my case.
@tfoxy Could you validate the issue? Maybe I broke something on my side, but maybe it is a bug in the library.
Also, I don’t fully understand why do you abort the optimization and set None
to the only_list
. I experimented with the code and assigned []
instead of None
in that function and it solved the issue.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (4 by maintainers)
@maarcingebala @tfoxy I submitted PR for this suggestion #15
Maybe there can be an option to enable or disable that feature.