This commit is contained in:
Zakhar 2026-09-05 20:35:33 +03:00
parent 56bafd22b9
commit 4965eb25d1

View File

@ -43,6 +43,7 @@ export function App() {
setProducts(data.cart.flat().map(product => normalizeProductImage(product))); setProducts(data.cart.flat().map(product => normalizeProductImage(product)));
setInitial(false, data.excess || 0, data.precision || 0); setInitial(false, data.excess || 0, data.precision || 0);
setIsCartComplete(false) setIsCartComplete(false)
}).finally(() => {
setShowLoader(false); setShowLoader(false);
}); });
}; };
@ -65,26 +66,34 @@ export function App() {
const handleDaysChange = useCallback(async (nextDays: number) => { const handleDaysChange = useCallback(async (nextDays: number) => {
setShowLoader(true); setShowLoader(true);
await setOption('days', nextDays); setOption('days', nextDays)
.finally(() => {
loadInitialState(); loadInitialState();
});
}, [loadInitialState]); }, [loadInitialState]);
const handleUsersChange = useCallback(async (nextUsers: User[]) => { const handleUsersChange = useCallback(async (nextUsers: User[]) => {
setShowLoader(true); setShowLoader(true);
await setOption('users', nextUsers); setOption('users', nextUsers)
.finally(() => {
loadInitialState(); loadInitialState();
});
}, [loadInitialState]); }, [loadInitialState]);
const handleCategoriesChange = useCallback(async (nextCategories: string[]) => { const handleCategoriesChange = useCallback(async (nextCategories: string[]) => {
setShowLoader(true); setShowLoader(true);
await setOption('initial_groups', nextCategories); setOption('initial_groups', nextCategories)
.finally(() => {
loadInitialState(); loadInitialState();
});
}, [loadInitialState]); }, [loadInitialState]);
const handlePercentChange = useCallback(async (fullness: number) => { const handlePercentChange = useCallback(async (fullness: number) => {
setShowLoader(true); setShowLoader(true);
await setOption('fullness', fullness); setOption('fullness', fullness)
.finally(() => {
loadInitialState(); loadInitialState();
})
}, [loadInitialState]); }, [loadInitialState]);
useEffect(() => { useEffect(() => {