From d65aefa44180c07377d938dcf8eb089e6c5233ce Mon Sep 17 00:00:00 2001 From: danilo neves cruz Date: Sun, 15 Feb 2026 23:30:22 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=A5=85=20app:=20globally=20suppress=20exp?= =?UTF-8?q?ected=20kyc=20api=20errors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/quiet-owls-rest.md | 5 +++++ src/utils/queryClient.ts | 13 +++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 .changeset/quiet-owls-rest.md diff --git a/.changeset/quiet-owls-rest.md b/.changeset/quiet-owls-rest.md new file mode 100644 index 000000000..d2acf26bf --- /dev/null +++ b/.changeset/quiet-owls-rest.md @@ -0,0 +1,5 @@ +--- +"@exactly/mobile": patch +--- + +🥅 globally suppress expected kyc api errors diff --git a/src/utils/queryClient.ts b/src/utils/queryClient.ts index 1c268f256..5d08baf78 100644 --- a/src/utils/queryClient.ts +++ b/src/utils/queryClient.ts @@ -16,6 +16,12 @@ import type { PersistedClient } from "@tanstack/query-persist-client-core"; import type { Address } from "viem"; const INVALIDATE_ON_UPGRADE = new Set(["kyc", "card", "pax"]); +const expected = (error: unknown) => + error instanceof APIError && + (error.text === "no kyc" || + error.text === "not started" || + error.text === "bad kyc" || + error.text === "kyc required"); function versionAwareDeserialize(cache: string): PersistedClient { const persistedClient: PersistedClient = deserialize(cache); @@ -40,10 +46,7 @@ const queryClient = new QueryClient({ if (error instanceof Error && error.message === "don't refetch") return; if (error instanceof APIError) { if (error.code === 401 && error.text === "unauthorized") return; - if (query.queryKey[0] === "card" && query.queryKey[1] === "details") { - if (error.text === "kyc required") return; - if (error.text === "bad kyc") return; - } + if (expected(error)) return; } reportError(error); }, @@ -268,8 +271,6 @@ queryClient.setQueryDefaults(["embedding-context"], { return null; }, }); -const expected = (error: unknown) => - error instanceof APIError && (error.text === "no kyc" || error.text === "not started" || error.text === "bad kyc"); queryClient.setQueryDefaults(["kyc", "status"], { staleTime: 5 * 60_000, gcTime: 60 * 60_000,