big performance changes
All checks were successful
Build and Release to Staging / Build Vision Start (push) Successful in 8s
Build and Release to Staging / Build Vision Start Image (push) Successful in 1m3s
Build and Release to Staging / Deploy Vision Start (staging) (push) Successful in 2s

This commit is contained in:
2026-07-03 14:28:26 -03:00
parent 83dcf65069
commit 1580187689
14 changed files with 298 additions and 444 deletions

View File

@@ -16,9 +16,26 @@ const Clock: React.FC<ClockProps> = ({ config, getClockSizeClass }) => {
const [time, setTime] = useState(new Date());
useEffect(() => {
const timerId = setInterval(() => setTime(new Date()), 1000);
return () => clearInterval(timerId);
}, []);
if (!config.clock.enabled) return;
const scheduleNext = () => {
const now = new Date();
const msToNextMinute = (60 - now.getSeconds()) * 1000 - now.getMilliseconds();
timeoutId = window.setTimeout(() => {
setTime(new Date());
intervalId = window.setInterval(() => setTime(new Date()), 60_000);
}, msToNextMinute);
};
let timeoutId = 0;
let intervalId = 0;
scheduleNext();
return () => {
if (timeoutId) window.clearTimeout(timeoutId);
if (intervalId) window.clearInterval(intervalId);
};
}, [config.clock.enabled]);
if (!config.clock.enabled) {
return null;