[High] refreshAssets useCallback defeats polling effect, causes timer drift #42

Closed
opened 2026-05-24 14:05:02 -04:00 by zgaetano · 0 comments
Owner

File: screens-library.jsx:59-88
Severity: High

PROJECTS is re-read from window.ZAMPP_DATA every render, creating a new array reference. The useCallback depends on [PROJECTS], so refreshAssets is a new function on every render. The polling useEffect cleans up and re-registers the interval on every render, causing timer drift.

Fix: Use window.ZAMPP_DATA.PROJECTS directly inside the callback and remove the dependency, or stabilize the ref with useMemo.

**File:** screens-library.jsx:59-88 **Severity:** High PROJECTS is re-read from window.ZAMPP_DATA every render, creating a new array reference. The useCallback depends on [PROJECTS], so refreshAssets is a new function on every render. The polling useEffect cleans up and re-registers the interval on every render, causing timer drift. **Fix:** Use window.ZAMPP_DATA.PROJECTS directly inside the callback and remove the dependency, or stabilize the ref with useMemo.
zgaetano added the
bug
label 2026-05-24 14:05:02 -04:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: WildDragonLLC/dragonflight#42
No description provided.