From 4965eb25d1aa7ef16b96aa964b013391705e5d2b Mon Sep 17 00:00:00 2001 From: Zakhar Date: Sat, 5 Sep 2026 20:35:33 +0300 Subject: [PATCH] loader --- src/App.tsx | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 17d05e6..956666c 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -43,6 +43,7 @@ export function App() { setProducts(data.cart.flat().map(product => normalizeProductImage(product))); setInitial(false, data.excess || 0, data.precision || 0); setIsCartComplete(false) + }).finally(() => { setShowLoader(false); }); }; @@ -65,26 +66,34 @@ export function App() { const handleDaysChange = useCallback(async (nextDays: number) => { setShowLoader(true); - await setOption('days', nextDays); - loadInitialState(); + setOption('days', nextDays) + .finally(() => { + loadInitialState(); + }); }, [loadInitialState]); const handleUsersChange = useCallback(async (nextUsers: User[]) => { setShowLoader(true); - await setOption('users', nextUsers); - loadInitialState(); + setOption('users', nextUsers) + .finally(() => { + loadInitialState(); + }); }, [loadInitialState]); const handleCategoriesChange = useCallback(async (nextCategories: string[]) => { setShowLoader(true); - await setOption('initial_groups', nextCategories); - loadInitialState(); + setOption('initial_groups', nextCategories) + .finally(() => { + loadInitialState(); + }); }, [loadInitialState]); const handlePercentChange = useCallback(async (fullness: number) => { setShowLoader(true); - await setOption('fullness', fullness); - loadInitialState(); + setOption('fullness', fullness) + .finally(() => { + loadInitialState(); + }) }, [loadInitialState]); useEffect(() => {