fix(imagery): re-probe cancelled auto-preview successor (merge main)

Reschedule thumbnail intent when pruning an empty automatic day changes
follow/preview, so a scrolled-off VIIRS successor cannot stay pending.

Add node:test regression for the cancelled successor. Preserve current main's
voice-cancel handling and changelog/docs. Review credit: gekh and
quanticsoul4772.

Tests not run locally; verify with node --test.
This commit is contained in:
Kevin Rajan committed 2026-11-10 10:48:03 -06:00
commit 4554cdf5c6
793 files changed
+139589 -3309

No files matched your search

+20
View File
@@ -822,7 +822,17 @@ export function createRecentImageryLayer({
// A probe can take a pinned day off the map or let a followed focus
// preview; both change more than the cards, so a full notification
// follows the thumbnail one.
const previousFollow = _followKey;
const previousPreview = _previewKey;
const pruned = pruneEmpty();
if (
pruned &&
(_followKey !== previousFollow || _previewKey !== previousPreview)
) {
// A new automatic day can have had its probe cancelled while offscreen.
// Re-request it even when the visible window has not moved.
requestThumbnails();
}
if (pruned) syncRender();
const followed =
Boolean(_followKey) &&
@@ -1214,6 +1224,16 @@ export function createRecentImageryLayer({
notify('alpha');
},
/** Stop catalog/preview work owned by a cancelled voice action. */
cancelPendingSearch() {
// Without a note the emptied strip would read as "no imagery".
if (_searching) _notice = msg('Search cancelled');
cancelSearch();
clearPending();
syncRender();
notify();
},
/**
* Forget the box, the candidates, both pins, the preview and any pending
* pick; reset opacity and split and cancel the box tool. Mode and
+52
View File
@@ -1153,6 +1153,48 @@ const dailyViirs = () =>
),
);
test('empty auto VIIRS re-requests a cancelled successor', async () => {
const f = fixture();
const days = dailyViirs();
const newest = days[0].key;
const next = days[1].key;
f.layer.setSources({ hls: false });
await f.ready(days);
assert.equal(f.diag().following, newest);
assert.ok(
f.thumbnails.retained.at(-1).includes(next),
'the next day was originally scheduled',
);
// Move the visible window away before either day answers: retention
// cancels the next day's probe but keeps the currently followed day.
f.layer.setVisibleRange(25, 29);
assert.equal(
f.thumbnails.retained.at(-1).includes(next),
false,
'the next day is no longer retained',
);
const before = f.thumbnails.requests.filter(([key]) => key === next).length;
f.thumbnails.probe(newest, 'empty');
assert.equal(f.diag().following, next);
assert.equal(f.snap().preview.pending, next);
assert.ok(
f.thumbnails.retained.at(-1).includes(next),
'the new follow day is retained without scrolling again',
);
assert.equal(
f.thumbnails.requests.filter(([key]) => key === next).length,
before + 1,
'the cancelled successor is requested again',
);
f.thumbnails.probe(next, 'present');
assert.equal(f.snap().preview.key, next);
assert.deepEqual(f.drapes(), { a: `${next}|none`, b: null });
});
test('restored pins outside the visible strip window are probed and swipe once present', async () => {
const f = fixture();
const days = dailyViirs();
@@ -1389,3 +1431,13 @@ test('with SELECT BOX armed, Escape clears the preview first and the next Escape
assert.equal(f.snap().toolActive, false);
await tool.destroy();
});
test('a voice search cancelled mid-flight says so instead of looking empty', async () => {
const f = fixture();
f.layer.enable();
f.layer.setBox(BOX);
assert.equal(f.snap().searching, true);
f.layer.cancelPendingSearch();
assert.equal(f.snap().searching, false);
assert.equal(f.snap().notice, 'Search cancelled');
});