This repository was archived by the owner on Jan 26, 2021. It is now read-only.
This repository was archived by the owner on Jan 26, 2021. It is now read-only.
Issues updating query after mutation #37
Open
Description
I have the following query that I would like to automatically update after I do a create mutation:
var Group = Parse.Object.extend("Group");
observe(props, state) {
var groupObject = new Group();
groupObject.id = props.selectedGroupId;
var agentQuery = new Parse.Query(Agent);
agentQuery.equalTo("group", groupObject);
return {agents: agentQuery};
},
When I do the following mutation, as seen in the parse javascript sdk docs, it properly creates the row in the back-end, but it doesn't trigger a react UI update:
var groupObject = new Group();
groupObject.id = groupId;
ParseReact.Mutation.Create("Agent", {
name: name,
group: groupObject
}).dispatch({waitForServer: true});
Looking at QueryTools.js, I tried changing the mutation to the following, and the query immediately updated in the UI:
var groupObject = new Group();
groupObject.id = groupId;
groupObject.objectId = groupId;
groupObject.className = 'Group';
ParseReact.Mutation.Create("Agent", {
name: namee,
group: groupObject
}).dispatch({waitForServer: true});
But this doesn't look like standard practice. What is the recommended way to dispatch a create mutation like the example I have?
Metadata
Metadata
Assignees
Labels
No labels