Fixed fallback interval not working on visits pages

This commit is contained in:
Alejandro Celaya 2022-12-06 18:09:50 +01:00
parent 5d712d7d78
commit 6f5c5b122f

View file

@ -122,6 +122,12 @@ export const VisitsStats: FC<VisitsStatsProps> = ({
getVisits({ dateRange: resolvedDateRange, filter: visitsFilter }, isFirstLoad.current);
isFirstLoad.current = false;
}, [dateRange, visitsFilter]);
useEffect(() => {
// As soon as the fallback is loaded, if the initial interval used the settings one, we do fall back
if (fallbackInterval && initialInterval.current === (settings.visits?.defaultInterval ?? 'last30Days')) {
initialInterval.current = fallbackInterval;
}
}, [fallbackInterval]);
const renderVisitsContent = () => {
if (loadingLarge) {