From 6a6cb3740c53c3c7f0d480ad418d9b56025267ae Mon Sep 17 00:00:00 2001 From: Phil Pluckthun Date: Wed, 22 Apr 2020 19:06:21 +0100 Subject: [PATCH] Remove special persistedFetchError event --- .../persisted-fetch/src/persistedFetchExchange.ts | 11 ++++------- packages/core/src/types.ts | 5 ----- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/exchanges/persisted-fetch/src/persistedFetchExchange.ts b/exchanges/persisted-fetch/src/persistedFetchExchange.ts index 18ec5c7ee4..d6393c0363 100644 --- a/exchanges/persisted-fetch/src/persistedFetchExchange.ts +++ b/exchanges/persisted-fetch/src/persistedFetchExchange.ts @@ -122,13 +122,10 @@ const makePersistedFetchSource = ( const error = !result.data ? result.error : undefined; dispatchDebug({ - type: persistFail - ? 'persistedFetchError' - : error - ? 'fetchError' - : 'fetchSuccess', + // TODO: Assign a new name to this once @urql/devtools supports it + type: persistFail || error ? 'fetchError' : 'fetchSuccess', message: persistFail - ? 'A Persisted Query request has failed. A normal GraphQL request will follow.' + ? 'A Persisted Query request has failed. A non-persisted GraphQL request will follow.' : `A ${ error ? 'failed' : 'successful' } fetch response has been returned.`, @@ -136,7 +133,7 @@ const makePersistedFetchSource = ( data: { url, fetchOptions, - value: error || result, + value: persistFail ? result.error : (error || result), }, }); }) diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index a6c058a36f..b690cf58a5 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -114,11 +114,6 @@ export interface DebugEventTypes { retryRetrying: { retryCount: number; }; - // persistedFetchExchange - persistedFetchError: { - url: string; - fetchOptions: RequestInit; - }; } export type DebugEventArg = {