From 4feaa40de796f537a74a8c56a78689611a6af6a0 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Wed, 15 May 2024 23:06:21 -0300 Subject: [PATCH] Fix makeLazy not incrementing tries if factory errors --- src/utils/lazy.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils/lazy.ts b/src/utils/lazy.ts index 582aa650c..90e2e7e88 100644 --- a/src/utils/lazy.ts +++ b/src/utils/lazy.ts @@ -20,9 +20,10 @@ export function makeLazy(factory: () => T, attempts = 5, { isIndirect = false const getter = () => { if (!cache && attempts > tries) { + tries++; cache = factory(); - if (!cache && attempts === ++tries && !isIndirect) { - console.error(`Lazy factory failed:\n\n${factory}`); + if (!cache && attempts === tries && !isIndirect) { + console.error(`makeLazy factory failed:\n\n${factory}`); } }