React native 中继现代兼容模式:未定义不是对象(正在评估';taggedNode[CLASSIC#u NODE]';)
在尝试保存兼容模式时看到此错误。这似乎与查询的中继特定部分(边缘/节点)有关。我们如何解决这个问题 查询是从Relay Classic中的工作内容最少更新的-只有NewWorkUtentRyedge被充实以获取节点和子成员 变异代码:React native 中继现代兼容模式:未定义不是对象(正在评估';taggedNode[CLASSIC#u NODE]';),react-native,relayjs,relay,React Native,Relayjs,Relay,在尝试保存兼容模式时看到此错误。这似乎与查询的中继特定部分(边缘/节点)有关。我们如何解决这个问题 查询是从Relay Classic中的工作内容最少更新的-只有NewWorkUtentRyedge被充实以获取节点和子成员 变异代码: const mutationQuery = graphql` mutation AddWorkoutEntryMutation($input: AddWorkoutEntryInput!, $dateOfEntry: String!) { AddWo
const mutationQuery = graphql`
mutation AddWorkoutEntryMutation($input: AddWorkoutEntryInput!,
$dateOfEntry: String!) {
AddWorkoutEntry(input: $input) {
clientMutationId
newWorkoutEntryEdge {
node {
id
category
description
notes
countOfRepetitions
}
}
userData {
id,
workoutEntries(first: 10000,
dateOfEntries: $dateOfEntry)
{
edges {
node {
id
category
description
notes
countOfRepetitions
}
}
}
}
}
}`
;
export default function AddWorkoutEntryMutation(
notes: string,
countOfRepetitions: string,
dateOfEntry: string,
standardWorkoutID: string,
userDataID: string)
{
const variables = {
input: {
notes,
countOfRepetitions,
dateOfEntry,
standardWorkoutID
},
// possibly redundant
dateOfEntry
};
commitMutation(Relay.Store, { mutationQuery, variables });
}
通过中继代码跟踪后,我意识到我正在将带有
mutationQuery
的对象作为字段传递,而不是mutation
,因此中继无法找到预期的突变字段
改变这个
commitMutation(Relay.Store, { mutationQuery, variables });
对此
commitMutation(Relay.Store, { mutation, variables });
解决了这个问题