Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct bad logic in optimization of single-object GraphQL endpoints #1120

Merged
merged 2 commits into from
Dec 3, 2021

Conversation

glennmatthews
Copy link
Contributor

Fixes: #1112

The optimization implementation in #769 for single-object GraphQL queries (e.g. device, circuit, as opposed to list queries devices, circuits) was incorrect - graphene-django-optimizer acts on querysets, not single objects, so we need to optimize a .filter(pk=pk) queryset instead of a .get(pk=pk) single object.

It appears that we didn't have any unit test coverage for single-object GraphQL queries, so I've added a couple of them and verified that this issue is caught by one of the added tests.

@glennmatthews
Copy link
Contributor Author

See also tfoxy/graphene-django-optimizer#61.

@glennmatthews glennmatthews merged commit 295796c into develop Dec 3, 2021
@glennmatthews glennmatthews deleted the gfm-issue-1112 branch December 3, 2021 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GraphQL single-object endpoints broken
2 participants