WB stats reliability: fix client apply-after-refetch, normalize ad dates, and add cache fallback\n\n- SalesTab: apply data immediately after refetch success to avoid empty state\n- Service: normalize advertising day dates to YYYY-MM-DD for correct range checks\n- Resolver: fallback to cached advertisingData when productsData is missing (429)\n\nHelps show data even when WB API rate-limits and fixes mixed-date aggregation.

This commit is contained in:
Bivekich
2025-08-11 22:30:45 +03:00
parent 3a56092385
commit 8ba8fc1214
3 changed files with 56 additions and 2 deletions

View File

@ -232,7 +232,11 @@ const SalesTab = React.memo(({
}
if (result.data?.getWildberriesStatistics?.success) {
console.warn('Sales: Loading fresh data from API')
// Обрабатываем данные в существующем useEffect
const rows = result.data.getWildberriesStatistics.data || []
if (rows.length > 0) {
// Применяем данные сразу, не дожидаясь обновления wbData
applyData(rows)
}
lastLoadedKeyRef.current = loadKey
}
} catch (error) {