perf(home): stop popular threads rerenders after load

This commit is contained in:
Tommaso Casaburi
2026-04-19 15:01:27 +07:00
parent 508fffe5d6
commit 4b06ac8c9a
7 changed files with 249 additions and 17 deletions
+5 -1
View File
@@ -8,10 +8,14 @@ import { useState, useEffect } from 'react';
* For visual updates like blinking animations, CSS handles that independently.
* This hook is for time-based calculations that don't need millisecond precision.
*/
export const useCurrentTime = (updateIntervalSeconds = 60) => {
export const useCurrentTime = (updateIntervalSeconds: number | false = 60) => {
const [currentTime, setCurrentTime] = useState(() => Date.now() / 1000);
useEffect(() => {
if (updateIntervalSeconds === false) {
return;
}
// Update periodically
const intervalId = setInterval(() => {
setCurrentTime(Date.now() / 1000);