Add Documentation for Relay Edge implementation
See original GitHub issueIn the Relay mutation docs, performing RANGE_ADD requires that the new edge created by the mutation is provided in the payload.
I do not know how to provide the correct cursor/Edge
construction within the relay.ClientIDMutation
subclass.
The following code I wrote:
new_object_edge = graphene.Field('ObjectEdge')
I believed would solve my issue, with a proper resolve_new_object_edge(...)
resolver.
However, my resolver cannot reference the relay.ConnectionField
that is specified on one of the other object types in my mutation, since it only has the context of my (in this case, Django) objects.
I experimented with relay.Edge.for_node(SomeObjectType)
as well but all of the solutions I have tried so far modify the schema correctly but cannot return the appropriate Edge
.
The implementation of this scenario in javascript can be found here in the Relay examples directory.
Any idea of a best approach? I can take this question to stack overflow, but felt that people using Relay & Graphene would enjoy seeing an example solution in the docs.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:3
- Comments:28 (15 by maintainers)
Top GitHub Comments
Since I struggled a lot to expose a newly created item as edge, here is a complete example using Graphene 2.0, building on the suggestions from @mickeyinfoshan and @varuna82. Hope this is of some help:
I’m using graphene-django 1.3 and neither
relay.types.Edge
orrelay.Edge
exist. Any idea from where can i import Edge ?? @mickeyinfoshan