(result: ExecutionResult)
| 182 | try { |
| 183 | const fullResponse: ExecutionResult = {}; |
| 184 | const handleResponse = (result: ExecutionResult) => { |
| 185 | // A different query was dispatched in the meantime, so don't |
| 186 | // show the results of this one. |
| 187 | if (queryId !== queryIdRef.current) { |
| 188 | return; |
| 189 | } |
| 190 | |
| 191 | let maybeMultipart = Array.isArray(result) ? result : false; |
| 192 | if ( |
| 193 | !maybeMultipart && |
| 194 | typeof result === 'object' && |
| 195 | result !== null && |
| 196 | 'hasNext' in result |
| 197 | ) { |
| 198 | maybeMultipart = [result]; |
| 199 | } |
| 200 | |
| 201 | if (maybeMultipart) { |
| 202 | for (const part of maybeMultipart) { |
| 203 | mergeIncrementalResult(fullResponse, part); |
| 204 | } |
| 205 | |
| 206 | setIsFetching(false); |
| 207 | setResponse(formatResult(fullResponse)); |
| 208 | } else { |
| 209 | const response = formatResult(result); |
| 210 | setIsFetching(false); |
| 211 | setResponse(response); |
| 212 | } |
| 213 | }; |
| 214 | |
| 215 | const fetch = fetcher( |
| 216 | { |
no test coverage detected