I have written below code :
On Certain User Action below method is called :
handleFolderClicked = (topic, parent) => {
console.log('Main : handleFolderClicked called : ', parent);
this.props.relay.setVariables({
parentFolder: parent,
email: loginEmail
});
}
Main = Relay.createContainer(Main, {
initialVariables: {
pageSize: pageSize,
email: loginEmail,
parentFolder: parentFolder,
},
fragments: {
store: () => Relay.QL`
fragment on Store {
id,
fileConnection(first:999, email:$email, parentFolder:$parentFolder) {
${DirectoryListing.getFragment('files')},
}
users {
email,
}
}
`,
}
});
export default Main;
On the time of page load its working fine and fetching results but when value of parentFolder is changed using setVariables, it throws above error.
An insight might be useful and appreciated. Thanks
I had this error and I solved with something like this:
Store
has to implement Relay'sNode
interface, meaning that it has to provide anid: ID!
field, and if you do a node query using the returned ID, yourStore
has to be returned.In my case I named my root object
viewer
of typeViewer
; so after implementing theNode
interface, this query has to work:Which returns:
Now if I use that ID to run a node Query, the viewer has to be returned. So for the query:
This should be the result:
Replace all occurrences of
viewer
/Viewer
withstore
/Store
and it should work.