fix: apply exact reviewer suggestions for MemberLogsTab

- Move endRefreshing() outside the !cancelled guard in finally block
  so it always runs even when the effect is torn down mid-refresh.
- Only call load() when isTabActive or on first load — prevents
  unnecessary fetches when a hidden tab's effect re-runs.
This commit is contained in:
Artem Rootman 2026-04-05 17:01:36 +00:00
parent 0e83d99e0a
commit e81116b85e
No known key found for this signature in database
GPG key ID: B7C30676209A822C

View file

@ -474,14 +474,16 @@ export const MemberLogsTab = ({
setError(e instanceof Error ? e.message : 'Unknown error');
}
} finally {
if (didBeginRefreshing) endRefreshing();
if (!cancelled) {
setLoading(false);
if (didBeginRefreshing) endRefreshing();
}
}
};
void load();
if (isTabActive || !hasLoadedRef.current) {
void load();
}
const interval = shouldAutoRefresh && isTabActive ? setInterval(() => void load(), 5000) : null;