2016-10-23 9 views
0

私はGitHunt-APIとGitHunt-Reactでpubsubコードを研究しています。Apollo:Props Query Option経由でupdateQueryにアクセスしていますか?

const withData = graphql(COMMENT_QUERY, { 
    options({ params }) { 
    return { 
     variables: { repoName: `${params.org}/${params.repoName}` }, 
    }; 
    }, 
    props({ data: { loading, currentUser, entry, updateQuery } }) { 
    return { loading, currentUser, entry, updateCommentsQuery: updateQuery }; 
    }, 
}); 

ここに私のアプリでは、それの現在のバージョンがあります:

const CreateIMPageWithDataAndMutations = graphql(GETIMS_QUERY, { 
    options({ toID, userID }) { 
     return { 
      variables: { fromID: `${userID}`, toID: `${toID}`} 
     }; 
    }, 
    props({ data: { loading, updateQuery } }) { 
     debugger; //<==CHECKING HERE SHOWS updateQuery IS UNDEFINED 
     return { loading, updateCommentsQuery: updateQuery }; 
    }, 

})(CreateIMPageWithMutations); 

updateQueryがundefinedとして来ている私は、このコードを参照してください。 updateQueryにアクセスするには何が必要ですか?

事前にすべての情報に感謝します。

+0

後で定義されますか?私の理解は、最初のクエリ結果が返されるまで 'updateQueries'は現在' undefined'です。おそらく、これは改善できるものです。 – stubailo

+0

'props'のコードは2回実行されます。 'loading 'の両方の時間が定義されていますが、' updateQuery'は定義されていません。 – VikR

答えて

0

スラックの@helferが答えを提供しました。 react-apolloを最新のバージョンに更新すると、それが修正されました。