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にアクセスするには何が必要ですか?
事前にすべての情報に感謝します。
後で定義されますか?私の理解は、最初のクエリ結果が返されるまで 'updateQueries'は現在' undefined'です。おそらく、これは改善できるものです。 – stubailo
'props'のコードは2回実行されます。 'loading 'の両方の時間が定義されていますが、' updateQuery'は定義されていません。 – VikR