mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
A user reported the dashboard crashing on returning to a backgrounded tab. The on-focus snapshot refetch re-rendered the page, and each chart received a fresh inline `() => markChartReady(id)` handler every render; the chart's data-ready notify effect, keyed on that ever-changing prop, re-fired on every commit. That per-commit passive effect kept the chart row's anchored popovers re-committing until the browser tripped its render-depth guard and the page fell back to its error card. Latch the notify behind a ref so it fires once, when the chart's initial query settles, and depend on the load flag alone. The handler is read through a ref so a late-arriving callback still fires without re-arming the effect. Extract the pure fire-once decision into a small helper with direct unit coverage (no DOM runner, per project convention).