From 812022e4531f0d4ed9c768f2c739635149a8cb93 Mon Sep 17 00:00:00 2001 From: Noah Prince <83885631+ChewingGlass@users.noreply.github.com> Date: Fri, 19 Jan 2024 17:01:11 -0500 Subject: [PATCH] Anothe useAccounts bugfix (#552) --- Cargo.lock | 8 ++++---- .../account-fetch-cache-hooks/src/hooks/useAccounts.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6af373c8a..2a7510af7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1336,7 +1336,7 @@ dependencies = [ [[package]] name = "data-credits" -version = "0.2.0" +version = "0.2.1" dependencies = [ "anchor-lang", "anchor-spl", @@ -1937,7 +1937,7 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "helium-entity-manager" -version = "0.2.3" +version = "0.2.4" dependencies = [ "account-compression-cpi", "anchor-lang", @@ -1958,7 +1958,7 @@ dependencies = [ [[package]] name = "helium-sub-daos" -version = "0.1.3" +version = "0.1.4" dependencies = [ "anchor-lang", "anchor-spl", @@ -2517,7 +2517,7 @@ dependencies = [ [[package]] name = "mobile-entity-manager" -version = "0.1.0" +version = "0.1.1" dependencies = [ "account-compression-cpi", "anchor-lang", diff --git a/packages/account-fetch-cache-hooks/src/hooks/useAccounts.ts b/packages/account-fetch-cache-hooks/src/hooks/useAccounts.ts index 2fbef7589..ea3a4b82a 100644 --- a/packages/account-fetch-cache-hooks/src/hooks/useAccounts.ts +++ b/packages/account-fetch-cache-hooks/src/hooks/useAccounts.ts @@ -106,7 +106,7 @@ export function useAccounts( // Sometimes eager result never gets set because cache or keys is undefined useEffect(() => { - if (eagerResult && accounts.length == 0 && (eagerResult?.length || 0) != 0) { + if (eagerResult && accounts.length != keys?.length && (eagerResult?.length || 0) == keys?.length) { setAccounts(eagerResult); } }, [accounts, eagerResult])