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

Relay: Wrap resolve_model_node with django_resolver #402

Open
SafaAlfulaij opened this issue Oct 27, 2023 · 3 comments
Open

Relay: Wrap resolve_model_node with django_resolver #402

SafaAlfulaij opened this issue Oct 27, 2023 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested

Comments

@SafaAlfulaij
Copy link

SafaAlfulaij commented Oct 27, 2023

Currently:
https://github.com/strawberry-graphql/strawberry-graphql-django/blob/8f82b84141c182980b5001b4f0f562c787fe2dda/strawberry_django/relay.py#L395

Only the actual get/first methods are being wrapped for async safety.

There are cases where I need to access data not fetched yet in the custom get_queryset resolver (permissions, system settings, etc) defined up:
https://github.com/strawberry-graphql/strawberry-graphql-django/blob/8f82b84141c182980b5001b4f0f562c787fe2dda/strawberry_django/relay.py#L380-L382

I went ahead and just wrapped the whole resolve_model_node resolver with django_resolver and didn't notice any difference.

I found this while trying to customize how a node is being resolved:

    node: relay.Node = relay.node()

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
@SafaAlfulaij SafaAlfulaij added the bug Something isn't working label Oct 27, 2023
@bellini666
Copy link
Member

Hi @SafaAlfulaij ,

Indeed the current get_queryset is not async safe.

Maybe we could wrap everything from that line to the end inside django_resolver? If so, it would make sense to do the same for non relay access as well

@SafaAlfulaij
Copy link
Author

@bellini666 Yeah, that should be sufficient.

@bellini666
Copy link
Member

@bellini666 Yeah, that should be sufficient.

@SafaAlfulaij do you want to try to open a PR for that? Otherwise I'll try to take a look at the end of this week

@bellini666 bellini666 added enhancement New feature or request help wanted Extra attention is needed question Further information is requested and removed bug Something isn't working labels Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants