mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
perf: Fix unnecessary renders in useCurrentTime hook and ModQueueView footer
This commit is contained in:
@@ -12,10 +12,7 @@ export const useCurrentTime = (updateIntervalSeconds = 60) => {
|
||||
const [currentTime, setCurrentTime] = useState(() => Date.now() / 1000);
|
||||
|
||||
useEffect(() => {
|
||||
// Update immediately on mount
|
||||
setCurrentTime(Date.now() / 1000);
|
||||
|
||||
// Then update periodically
|
||||
// Update periodically
|
||||
const intervalId = setInterval(() => {
|
||||
setCurrentTime(Date.now() / 1000);
|
||||
}, updateIntervalSeconds * 1000);
|
||||
|
||||
Reference in New Issue
Block a user