fix: Initialize lastPollTime on first RAF callback

Co-authored-by: jhbruhn <1036566+jhbruhn@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-12-28 08:43:07 +00:00
parent 03e083b4a3
commit cca86ff53e

View file

@ -382,6 +382,11 @@ export const useMachineStore = create<MachineState>((set, get) => ({
// - Smoother animations and UI updates // - Smoother animations and UI updates
// - More efficient rendering // - More efficient rendering
const poll = async (timestamp: number) => { const poll = async (timestamp: number) => {
// Initialize lastPollTime on first call
if (lastPollTime === 0) {
lastPollTime = timestamp;
}
// Check if enough time has passed since last poll // Check if enough time has passed since last poll
const interval = getPollInterval(); const interval = getPollInterval();
const elapsed = timestamp - lastPollTime; const elapsed = timestamp - lastPollTime;