-
-
Notifications
You must be signed in to change notification settings - Fork 569
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
Add Relay viewer field #49
Conversation
Great work, it's almost perfect! However, Viewer has to implement Node interface to be used with relay mutations. The open question here is what should be the id field of viewer node. I was thinking about id of current postgresql role. Another thing, that is much easier to add, is missing edge field in mutation payload. The edge type definition is already there, it just needs to be attached to mutation payload. For example, currently InsertTodoPayload contains:
The desired structure is:
|
So Relay wants the edge with the cursor? |
Also, I really can't believe Relay wants |
Answers for both questions can be found in Relay docs for RANGE_ADD mutation
This is required for
Relay documentation doesn't directly mention Viewer field much, so this requirement is rather implicit. Take a look on the Reindex docs on mutations also contain good examples and explanations. |
@calebmer Yes, it does need to be a node, and it does need to implement the Re: the discussion around the viewer ID. In all my previous apps and others I've seen, this was always a singleton, so the ID doesn't really matter. The viewer node is simply a static entry point. I've implemented this as |
Ok, so I'd also need the |
That's correct. The viewer field type itself is really simple, but it does require a bit of wiring up, unfortunately. |
After some work with Relay I better understand the need for this. With that knowledge, do you think Then the name |
@calebmer see this issue facebook/relay#820. However |
I agree that * lame excuse ;) |
Ok, viewer is general enough. We could recommend I'll implement |
I am confused … since your fixtures actually include the id and the node interface |
Looks great! I'm gonna try it with Relay today and let you know. |
f487ca0
to
48603f3
Compare
48603f3
to
897de57
Compare
Released in |
Is there a plan for |
@rojobuffalo: In #145 I did end up renaming the functionality is exactly the same and you can always alias |
Aliasing is done by |
@Valorize correct 👍 Out of curiosity, why are you interested in aliasing the field to |
@calebmer Just saw that you mentioned it's possible. So I wanted to be sure how to do it. I guess it's best to use as less aliases as possible. |
Adds a Relay viewer field to the root query type and to all of the mutation payloads. @hardchor, @msimulcik is this what you’re looking for?
Closes #38 and maybe #43.