Skip to content

Now: reset every clock face, and be available whenever one is off live - #2364

Merged
github-actions[bot] merged 2 commits into
devfrom
mapclock-now-charts
Sep 21, 2026
Merged

github-actions[bot] merged 2 commits into
devfrom
mapclock-now-charts

Conversation

@msupino

@msupino msupino commented Sep 21, 2026

Copy link
Copy Markdown
Owner

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-time there 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:

Other layers Chart
Before live the 2-hour-old sheet, pinned
After live the sheet an hour out, free to advance

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 thing poll()'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 of followInstant, 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:

Control Moved by Lit Now before Now
Map / inspector time slider the pilot
#wx-time chart dropdown, in the toolbar the pilot
Density-altitude slider on an airfield panel the pilot

Pressing Now already reset all three — scrubbed() cascades through the master into the DA mirrors, and pullCharts() 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:

  • The dropdown counts only while a chart overlay is actually on: with none up, the selected sheet changes nothing a pilot can see.
  • 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 the MutationObserver watching the panel body never saw it; a delegated input listener 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.

Test Against the old code
Now returns the sheet valid right now fails — gives the −2h sheet
Now leaves the dropdown unpinned, still advancing fails — a newer sheet is ignored
dragging the slider to zero does the same fails
a chart time the pilot picked lights Now, and Now takes it back fails — button stays dead
the density-altitude slider lights Now, and Now resets it fails — button stays dead
a chart time still ahead of live survives a re-seed passes — guard against over-releasing
a chart time that IS the live sheet leaves Now dead passes — guard against lighting it for nothing
with no chart layer on, the dropdown does not light Now passes — same

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

"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
@github-actions

github-actions Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

🚀 Preview deployed

Open PR preview →

https://navaid.supino.org/pr/2364/

Commit: 6dcc290

⚠️ Unreviewed branch code on the production origin. It gets its own storage namespace and no service worker, but that is not a sandbox — a same-origin frame can still reach the live app's saved routes, settings and BYOK/Drive credentials. Open it as you would run this branch locally. Not indexed; rebuilt on every push.

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
msupino marked this pull request as ready for review September 21, 2026 09:09
@github-actions
github-actions Bot enabled auto-merge (squash) September 21, 2026 09:09
@msupino msupino changed the title Let Now release the chart time with every other layer Now: reset every clock face, and be available whenever one is off live Sep 21, 2026
@github-actions
github-actions Bot merged commit fce1490 into dev Sep 21, 2026
26 checks passed
@github-actions
github-actions Bot deleted the mapclock-now-charts branch September 21, 2026 09:24

This branch was successfully deployed

2 active deployments
pr-preview-2364 6dcc290c Deployed Sep 21, 2026 by github-actions[bot]
github-pages 6dcc290c Deployed Sep 21, 2026 by msupino via deploy #8538
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant