Apollo:通过Props查询选项访问updateQuery?

时间:2016-10-23 18:17:35

标签: graphql apollo apollo-server

我正在研究GitHunt-API和GitHunt-React中的pubsub代码。我看到这段代码:

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?

提前致谢所有信息。

1 个答案:

答案 0 :(得分:0)

@helfer对Slack提供了答案。将react-apollo更新到最新版本修复它。

相关问题