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:
parent
0e83d99e0a
commit
e81116b85e
1 changed files with 4 additions and 2 deletions
|
|
@ -474,14 +474,16 @@ export const MemberLogsTab = ({
|
||||||
setError(e instanceof Error ? e.message : 'Unknown error');
|
setError(e instanceof Error ? e.message : 'Unknown error');
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
if (didBeginRefreshing) endRefreshing();
|
||||||
if (!cancelled) {
|
if (!cancelled) {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
if (didBeginRefreshing) endRefreshing();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void load();
|
if (isTabActive || !hasLoadedRef.current) {
|
||||||
|
void load();
|
||||||
|
}
|
||||||
|
|
||||||
const interval = shouldAutoRefresh && isTabActive ? setInterval(() => void load(), 5000) : null;
|
const interval = shouldAutoRefresh && isTabActive ? setInterval(() => void load(), 5000) : null;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue