【发布时间】:2017-02-12 21:03:55
【问题描述】:
我已将 GitHunt-React 中的以下代码(以及我能找到的所有其他相关代码)复制到我的应用程序中。此代码来自 CommentsPage.js:
const CommentsPageWithDataAndMutations = graphql(COMMENT_QUERY, {
options({ params }) {
return {
variables: { repoName: `${params.org}/${params.repoName}` },
};
},
props({ data: { loading, currentUser, entry, updateQuery } }) {
debugger;
return { loading, currentUser, entry, updateCommentsQuery: updateQuery };
},
})(CommentsPageWithMutations);
由于某种原因,在我的应用程序中,加载有时设置为 true,有时未定义。当我在 GitHunt-React 中单步执行此代码时(不是我的应用程序,而是原始示例代码),调用堆栈显示所有 React 内部函数,所以我无法将其追溯到 GitHunt-React 中声明 loading 的代码。此外,在 GitHunt-React 中对源代码进行文本搜索,似乎没有发现任何设置 loading. 值的内容
在 GitHunt-React 中,哪部分代码负责声明loading 并设置其值?
【问题讨论】:
标签: reactjs graphql apollo apollostack