mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
perf(home): stop popular threads rerenders after load
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user