Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
React native 中继现代兼容模式:未定义不是对象(正在评估';taggedNode[CLASSIC#u NODE]';)_React Native_Relayjs_Relay - Fatal编程技术网

React native 中继现代兼容模式:未定义不是对象(正在评估';taggedNode[CLASSIC#u NODE]';)

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

在尝试保存兼容模式时看到此错误。这似乎与查询的中继特定部分(边缘/节点)有关。我们如何解决这个问题

查询是从Relay Classic中的工作内容最少更新的-只有NewWorkUtentRyedge被充实以获取节点和子成员

变异代码:

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 });
解决了这个问题