diff --git a/exchanges/persisted-fetch/src/persistedFetchExchange.ts b/exchanges/persisted-fetch/src/persistedFetchExchange.ts index e38f49bb51..b6d3449d3c 100644 --- a/exchanges/persisted-fetch/src/persistedFetchExchange.ts +++ b/exchanges/persisted-fetch/src/persistedFetchExchange.ts @@ -12,8 +12,7 @@ import { takeUntil, } from 'wonka'; -import { - makeOperation, +import type { CombinedError, ExchangeInput, Exchange, @@ -154,27 +153,24 @@ const makePersistedFetchSource = ( dispatchDebug: ExchangeInput['dispatchDebug'], useGet: boolean ): Source => { - const newOperation = makeOperation(operation.kind, operation, { - ...operation.context, - preferGetMethod: useGet ? 'force' : operation.context.preferGetMethod, - }); + if (useGet) operation.context.preferGetMethod = 'force'; - const url = makeFetchURL(newOperation, body); - const fetchOptions = makeFetchOptions(newOperation, body); + const url = makeFetchURL(operation, body); + const fetchOptions = makeFetchOptions(operation, body); dispatchDebug({ type: 'fetchRequest', message: !body.query ? 'A fetch request for a persisted query is being executed.' : 'A fetch request is being executed.', - operation: newOperation, + operation, data: { url, fetchOptions, }, }); - let fetch$ = makeFetchSource(newOperation, url, fetchOptions); + let fetch$ = makeFetchSource(operation, url, fetchOptions); if (process.env.NODE_ENV !== 'production') { fetch$ = pipe(