Mirror: The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(core): Add alternative rethrow method by wrapping yield (#3063)

authored by

Phil Pluckthun and committed by
GitHub
33d64b0a 9f91c2bd

+12 -3
+5
.changeset/silent-numbers-look.md
··· 1 + --- 2 + '@urql/core': patch 3 + --- 4 + 5 + Ensure network errors are always issued with `CombinedError`s, while downstream errors are re-thrown.
+7 -3
packages/core/src/internal/fetchSource.ts
··· 104 104 url: string, 105 105 fetchOptions: RequestInit 106 106 ) { 107 + let networkMode = true; 107 108 let abortController: AbortController | void; 108 109 let result: OperationResult | null = null; 109 110 let response: Response; ··· 132 133 } 133 134 134 135 for await (const payload of results) { 135 - yield (result = result 136 + result = result 136 137 ? mergeResultPatch(result, payload, response) 137 - : makeResult(operation, payload, response)); 138 + : makeResult(operation, payload, response); 139 + networkMode = false; 140 + yield result; 141 + networkMode = true; 138 142 } 139 143 140 144 if (!result) { 141 145 yield (result = makeResult(operation, {}, response)); 142 146 } 143 147 } catch (error: any) { 144 - if (result) { 148 + if (!networkMode) { 145 149 throw error; 146 150 } 147 151