2017-05-16 31 views
0

嘗試保存Compat模式突變時看到此錯誤。看起來它可能與查詢的特定於中繼的部分(邊緣/節點)有關。我們如何解決這個問題?繼電器現代compat模式:undefined不是一個對象(評估'taggedNode [CLASSIC_NODE]')

查詢從Relay Classic中工作的最低限度更新 - 只有newWorkoutEntryEdge已充實以獲取節點和子成員。

突變代碼:

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 }); 
} 

enter image description here

回答

0

通過繼電器代碼跟蹤在此之後,我意識到我是路過的對象與mutationQuery作爲一個領域,而不是mutation,所以繼電器找不到預期的突變領域。

更改此

commitMutation(Relay.Store, { mutationQuery, variables }); 

這個

commitMutation(Relay.Store, { mutation, variables }); 

解決了這個問題。

相關問題