-
-
Notifications
You must be signed in to change notification settings - Fork 51
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 refetching support #106
Conversation
Opened this as draft to collect some early feedback, global IDs are already working, I will tackle the |
Part 1 of what is needed for ash-project#99. The other half is implementing the node query.
@zachdaniel I think we're almost there but right now only the ID gets selected because it seems the fields contained in the type-specific fragments don't get included in the selected fields by Ash. Is there something where, e.g., interfaces are implemented that I can take as reference to see if I can make this work? |
The is_type_of implementation wasn't actually working
Use Ash.Error.Invalid.InvalidPrimaryKey and provide its protocol implementation to render it to a Graphql error
@zachdaniel this is now ready for review, now I implement the node interface for resources with a primary key get. I also had to change some of the code regarding field selection for the reason I mentioned above (fields coming from fragment weren't being selected), it is now working correctly. |
@@ -4118,4 +4154,11 @@ defmodule AshGraphql.Resource do | |||
name | |||
end | |||
end | |||
|
|||
def primary_key_get_query(resource) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think one of the things we'll need to do soon here is make this configurable, but the strategy of choosing an existing gql query for it to mimic is pretty neat.
looks like some credo failures to address, then we can merge it :) |
This allows picking also up fields coming from fragments in queries returning an interface
Allow retrieving a resource implementing the Node interface given its Relay global id. Close ash-project#99
It was complaining about the two |
😆 of course. We can also just delete that credo rule. |
awesome work! 🚀 Thank you for your contribution! 🚀 |
Slight API improvement over ash-project#106. This makes it more ergonomic to partially match on the return value (and it also makes it more explicit by explicitly labeling the two parts)
Slight API improvement over ash-project#106. This makes it more ergonomic to partially match on the return value (and it also makes it more explicit by explicitly labeling the two parts). Also add tests for relay id encoding/decoding.
Slight API improvement over #106. This makes it more ergonomic to partially match on the return value (and it also makes it more explicit by explicitly labeling the two parts). Also add tests for relay id encoding/decoding.
Add support for Relay global IDs and the
node
query, see https://relay.dev/graphql/objectidentification.htmContributor checklist