The scroll cache in hazards, hourly and travel forecast is invalidated by
comparing element identity, but the lines element is persistent - a rebuild
only replaces its children - and displayHeight is a fixed value from css. Both
conditions stay false after the first measurement, so maxOffset keeps the
height of whatever content was measured first. When later content is taller,
the scroll clamps at the old offset and sits frozen there for the rest of the
screen's timing.
Invalidate the cache explicitly when the list is rebuilt, and reset
navBaseCount so new content scrolls from the top.
Invalidating alone would regress hazards: it refreshes every 60 seconds but a
long multi-alert scroll can run for several minutes, so rebuilding on every
refresh would restart it from the top and it would never reach the end. Each
display now also compares a signature of the content it is about to render and
skips the rebuild entirely when nothing changed, leaving an in-progress scroll
undisturbed. Hourly's signature includes the starting hour because its row
labels are derived from the current time.
- Replace magic numbers with seconds-based timing constants
- Switch from scrollTo() to hardware-accelerated transform for smooth scrolling
- Add scroll caching to prevent repeated DOM queries every scroll cycle
- Fix calculations to support flexible hourly forecast lengths
(i.e. in the future, could offer every other hour)
- Switch to safeJson() for centralized error handling