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

Expected response payload to include the newly created edge #521

Closed
jwaldrip opened this issue Oct 27, 2015 · 7 comments
Closed

Expected response payload to include the newly created edge #521

jwaldrip opened this issue Oct 27, 2015 · 7 comments

Comments

@jwaldrip
Copy link

I am getting this error:

Warning: writeRelayUpdatePayload(): Expected response payload to include the newly created edge `listEdge` and its `node` field. Did you forget to update the `RANGE_ADD` mutation config?

Can someone explain how to solve the issue of Relay not requesting an Edge object. I have seen numerous posts, but no real clear solution. Here is a gist will all the information:

https://gist.github.com/jwaldrip/a1aa07745151a6ce6add

@jwaldrip jwaldrip changed the title Warning: writeRelayUpdatePayload(): Expected response payload to include the newly created edge listEdge and its node field. Did you forget to update the RANGE_ADD mutation config? Expected response payload to include the newly created edge Oct 27, 2015
@johanobergman
Copy link

My response from discord:

johanobergman: @jwaldrip I think it might happen if your rangeBehaviors doesn't cover all possible cases of query arguments.
I think relay checks rangeBehaviors twice, once before the request and once after. I had an issue with multiple arguments where it required the order of arguments to be both arg1.arg2 and arg2.arg1
so I specified it twice...

Is this a bug? I've seen a recent commit (4aef069) which should allow arguments in any order. Will that fix the issue?

@josephsavona
Copy link
Contributor

Relay will only fetch the newly created edge if some part of the application is actively querying for the range. In the gist the mutation configs include the following:

{
  type: 'RANGE_ADD',
  parentName: 'root',
  parentID: this.props.root.id,
  connectionName: 'lists',
  edgeName: 'listEdge',
  rangeBehaviors: {
    '': 'append'
  }
}

The new edge (field listEdge) will not be fetched unless some part of the application is rendering the lists connection -otherwise, Relay doesn't know what fields on listEdge are necessary - recursively expanding all possible subfields would fetch too much data.

@IlyasM
Copy link

IlyasM commented Oct 29, 2015

@josephsavona, I have StoriesPage which is a root container. Along with StoriesPage I have AddStoryPage which is also a rootContainer so when I go from StoriesPage to AddStoryPage there I do AddStoryMutation (RangeAdd on StoryConnection) which succeeds (new edge's fields match the stories connection node fields which is queried in StoriesPage) and on success I go back to StoriesPage but there the new edge has not been added unless I do full reload, shouldn't it be updating as it is the only page requesting stories connection? for rangeBehaviors I have {'' : ''}

@steveluscher
Copy link
Contributor

Thanks for your question! I have an answer for you, but…

We want to make sure to keep signal strong in the GitHub issue tracker – to make sure that it remains the best place to track issues that affect the development of Relay.

Questions like yours deserve a purpose-built Q&A forum. Would you like to copy/paste this question to Stack Overflow with the tag #relayjs? I'll be happy to answer there. Post a link to your Stack Overflow question here, to so that we don't lose track of it.

https://stackoverflow.com/questions/ask?tags=relayjs

@IlyasM
Copy link

IlyasM commented Nov 3, 2015

@steveluscher
Copy link
Contributor

Oh, I was talking to @jwaldrip, @IlyasM. I have an answer to his question, but not yours yet. Can you supply code samples in your Stack Overflow question?

@bfwg
Copy link

bfwg commented Feb 7, 2016

@steveluscher Hi, I run into the same problem out of nowhere, can you tell me the answer to jwaldrip's problem?
Thanks

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

No branches or pull requests

6 participants