Skip to content

Commit 19dd719

Browse files
authored
test: no race conditions (#7027)
1 parent 700ec77 commit 19dd719

File tree

4 files changed

+190
-271
lines changed

4 files changed

+190
-271
lines changed

packages/libraries/core/src/client/client.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ export function createHive(options: HivePluginOptions): HiveClient {
233233
? createPersistedDocuments({
234234
...options.experimental__persistedDocuments,
235235
logger,
236+
fetch: options.experimental__persistedDocuments.fetch,
236237
})
237238
: null,
238239
};

packages/libraries/core/src/client/persisted-documents.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ type HeadersObject = {
1010
export function createPersistedDocuments(
1111
config: PersistedDocumentsConfiguration & {
1212
logger: Logger;
13+
fetch?: typeof fetch;
1314
},
1415
): null | {
1516
resolve(documentId: string): PromiseOrValue<string | null>;
@@ -51,6 +52,7 @@ export function createPersistedDocuments(
5152
},
5253
logger: config.logger,
5354
isRequestOk: response => response.status === 200 || response.status === 404,
55+
fetchImplementation: config.fetch,
5456
})
5557
.then(async response => {
5658
if (response.status !== 200) {

packages/libraries/core/src/client/types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,11 @@ export type PersistedDocumentsConfiguration = {
304304
* @default 10_000
305305
*/
306306
cache?: number;
307+
/**
308+
* WHATWG Compatible fetch implementation
309+
* used for doing HTTP requests.
310+
*/
311+
fetch?: typeof fetch;
307312
};
308313

309314
export type AllowArbitraryDocumentsFunction = (context: {

0 commit comments

Comments
 (0)