From 6fe00c3cd06ba2c43944d51a23dc85e4dc28921e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Torres?= Date: Wed, 24 Apr 2024 10:31:03 +0100 Subject: [PATCH] hotfix: optimize select filter function --- packages/web-app/app/_lib/queries.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/web-app/app/_lib/queries.tsx b/packages/web-app/app/_lib/queries.tsx index 150be979..3ce820ca 100644 --- a/packages/web-app/app/_lib/queries.tsx +++ b/packages/web-app/app/_lib/queries.tsx @@ -67,6 +67,9 @@ export const useFetchIdOSProfile = () => { }); }; +const filterCredentials = (credentials: idOSCredential[] | null) => + credentials && credentials.filter((credential) => !credential.original_id); + export const useFetchCredentials = () => { const { sdk, hasSigner, address } = useIdOS(); @@ -83,9 +86,7 @@ export const useFetchCredentials = () => { .map((c) => c.id), })); }, - select: (credentials) => - credentials && - credentials.filter((credential) => !credential.original_id), + select: filterCredentials, enabled: !!(sdk && hasSigner && address), }); };