@@ -93,11 +93,42 @@ const Issues = ({
9393 />
9494
9595 { isShow ( showState ) && (
96- < IssuesList
97- repositoryOwner = { repositoryOwner }
98- repositoryName = { repositoryName }
99- showState = { showState }
100- />
96+ < Query
97+ query = { GET_ISSUES_OF_REPOSITORY }
98+ variables = { {
99+ repositoryOwner,
100+ repositoryName,
101+ kindOfIssue : KIND_OF_ISSUES [ showState ] ,
102+ } }
103+ notifyOnNetworkStatusChange = { true }
104+ >
105+ { ( { data, loading, error, fetchMore } ) => {
106+ if ( error ) {
107+ return < ErrorMessage error = { error } /> ;
108+ }
109+
110+ const { repository } = data ;
111+
112+ if ( loading && ! repository ) {
113+ return < Loading /> ;
114+ }
115+
116+ if ( ! repository . issues . edges . length ) {
117+ return < div className = "IssueList" > No issues ...</ div > ;
118+ }
119+
120+ return (
121+ < IssuesList
122+ showState = { showState }
123+ repositoryOwner = { repositoryOwner }
124+ repositoryName = { repositoryName }
125+ issues = { repository . issues }
126+ loading = { loading }
127+ fetchMore = { fetchMore }
128+ />
129+ ) ;
130+ } }
131+ </ Query >
101132 ) }
102133 </ div >
103134) ;
@@ -130,63 +161,38 @@ const IssueFilter = ({
130161) ;
131162
132163const IssuesList = ( {
164+ showState,
133165 repositoryOwner,
134166 repositoryName,
135- showState,
167+ issues,
168+ loading,
169+ fetchMore,
136170} ) => (
137- < Query
138- query = { GET_ISSUES_OF_REPOSITORY }
139- variables = { {
140- repositoryOwner,
141- repositoryName,
142- kindOfIssue : KIND_OF_ISSUES [ showState ] ,
143- } }
144- notifyOnNetworkStatusChange = { true }
145- >
146- { ( { data, loading, error, fetchMore } ) => {
147- if ( error ) {
148- return < ErrorMessage error = { error } /> ;
149- }
150-
151- const { repository } = data ;
152-
153- if ( loading && ! repository ) {
154- return < Loading /> ;
155- }
156-
157- if ( ! repository . issues . edges . length ) {
158- return < div className = "IssueList" > No issues ...</ div > ;
159- }
160-
161- return (
162- < div className = "IssueList" >
163- { repository . issues . edges . map ( ( { node } ) => (
164- < IssueItem
165- key = { node . id }
166- issue = { node }
167- repositoryOwner = { repositoryOwner }
168- repositoryName = { repositoryName }
169- />
170- ) ) }
171-
172- < FetchMore
173- loading = { loading }
174- hasNextPage = { repository . issues . pageInfo . hasNextPage }
175- variables = { {
176- cursor : repository . issues . pageInfo . endCursor ,
177- repositoryOwner,
178- repositoryName,
179- kindOfIssue : KIND_OF_ISSUES [ showState ] ,
180- } }
181- updateQuery = { updateQuery }
182- fetchMore = { fetchMore }
183- >
184- Issues
185- </ FetchMore >
186- </ div >
187- ) ;
188- } }
189- </ Query >
171+ < div className = "IssueList" >
172+ { issues . edges . map ( ( { node } ) => (
173+ < IssueItem
174+ key = { node . id }
175+ issue = { node }
176+ repositoryOwner = { repositoryOwner }
177+ repositoryName = { repositoryName }
178+ />
179+ ) ) }
180+
181+ < FetchMore
182+ loading = { loading }
183+ hasNextPage = { issues . pageInfo . hasNextPage }
184+ variables = { {
185+ cursor : issues . pageInfo . endCursor ,
186+ repositoryOwner,
187+ repositoryName,
188+ kindOfIssue : KIND_OF_ISSUES [ showState ] ,
189+ } }
190+ updateQuery = { updateQuery }
191+ fetchMore = { fetchMore }
192+ >
193+ Issues
194+ </ FetchMore >
195+ </ div >
190196) ;
191197
192198export default withState (
0 commit comments