Now: reset every clock face, and be available whenever one is off live - #2364
Merged
Merged
Conversation
"Now" says it shows every layer as it is right now, and the charts are a layer. They did not come back with the rest. Scrubbing the clock pulls the weather charts to the newest sheet issued by the chosen hour, and PINS the shared #wx-time dropdown there so the ten-minute re-poll cannot drag a scrubbing pilot back to the present. Coming back to live ran the same code with an offset of zero: the dropdown was pulled to the newest sheet issued by NOW and pinned there too. Those are different sheets. The dropdown seeds itself to the sheet NEAREST now -- an hour out, if that is the closest -- while "newest issued by" can only ever look backwards, so half the time the map returned to live with a chart the other layers had left behind, and the pin meant no later poll could correct it. Returning to live now releases the pin instead of setting one, and re-seeds by the dropdown's own nearest-now rule. NavWxTime.live() also drops the stored preference, as poll()'s existing release path does -- otherwise the next reload would resurrect the very time the pilot just asked to leave. Both ways back count: the Now button, and dragging the slider to zero. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016GmLy5kufzfY8roPqZUBeZ
Contributor
🚀 Preview deployed
Commit: |
Three controls answer to the map clock and each can be moved on its own: the shared hour, the chart valid-time dropdown in the toolbar, and the density-altitude slider on an open airfield panel (which renders locally and never drives the master). Now reset all three -- but it was only offered when the SLIDER had moved, so a pilot who picked a future chart from the dropdown, or dragged the panel's slider forward, was left looking at a future hour beside a dead button and no way back but a reload. Now is available whenever any of the three is off live, and dead only when all of them are at it. The chart dropdown counts only while a chart overlay is actually on the map: with none up, the selected sheet changes nothing a pilot can see, and picking the sheet the dropdown had already seeded is not a move off live whatever the pin says -- NavWxTime.offLive() compares the selection against the sheet valid now, not against whether one was chosen. Two events had to be wired for this. The dropdown already published its changes (onChange), which relabelled the charts line but not the button. The panel's slider changes a value and not the tree, so the MutationObserver watching the panel body never saw it; a delegated input listener does. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016GmLy5kufzfY8roPqZUBeZ
msupino
marked this pull request as ready for review
September 21, 2026 09:09
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two reports about the Now button on the map clock, one PR.
1. Now moved the chart dropdown to the wrong sheet — and locked it there
Scrubbing the clock pulls the weather charts to the newest sheet issued by the chosen hour, and pins
#wx-timethere so the ten-minute re-poll cannot drag a scrubbing pilot back to the present. Coming back to live ran that same code with an offset of zero: the dropdown was pulled to the newest sheet issued by now, and pinned there too.Those are not the same sheet. The dropdown seeds itself to the sheet nearest now, which can look forward; "newest issued by" can only look back. With sheets published at −2h and +1h:
The pin was the second half of it: even the re-poll could not correct the map, so it stayed on the stale chart until a reload.
Fix.
NavWxTime.live()drops the pin (the pilot's own pick, or the one the scrub set), removes the stored preference — the same thingpoll()'s existing release path does, or the next reload resurrects the time the pilot just asked to leave — and re-seeds by the dropdown's own nearest-now rule.pullCharts()calls it at offset zero instead offollowInstant, so both ways back to live count: the Now button, and dragging the slider to zero.2. Now was not available when something other than the slider had moved
Three controls answer to this clock and each can be moved on its own:
#wx-timechart dropdown, in the toolbarPressing Now already reset all three —
scrubbed()cascades through the master into the DA mirrors, andpullCharts()releases the dropdown. Only the enablement was wrong:nowBtn.disabled = h === 0. A pilot who picked a future chart, or dragged the panel's own slider forward, was left looking at a future hour beside a dead button, with no way back but a reload.offLive()is now the hour, the DA slider on an open panel, and the charts — Now is dead only when all three are at live. Two nuances:NavWxTime.offLive()compares the selection against the sheet valid now, not against whether a pin exists — choosing the sheet the dropdown had already seeded is not a move off live.Two events needed wiring. The dropdown already published its changes (
onChange), which relabelled the charts line but not the button. The panel's slider changes a value, not the tree, so theMutationObserverwatching the panel body never saw it; a delegatedinputlistener does.Tests
Eight added to
tests/map-time-clock.spec.js(27 in the spec). The sheets are published at −2h / +1h / +10h from the moment the test runs, so "nearest now" and "newest issued by now" are provably different options rather than whatever the wall clock happens to make them.Each failing case was run against the un-fixed code to confirm it fails there.
Also ran the density-altitude, da-follows-lookahead, mobile-chrome and wx-time-dynamic specs: 70 passed. Shard 2/4 locally: 976 passed.
🤖 Generated with Claude Code
https://claude.ai/code/session_016GmLy5kufzfY8roPqZUBeZ