Recent Imagery: hand a deferred slot over when the pick gives way to an empty card

While a user pick kept first claim on the slot of an empty automatic
day, a click or an arrow key onto a card already confirmed empty dropped
that pick but left the hand-over waiting for the next probe result. Until
then the map stayed blank and the Esri lease stayed held, where main
showed the next ranked day.

focus() and preview() now hand the slot over at once when no pick is
left. An arrow key onto an empty card no longer follows that day, as a
click already did, so focus stays on the card the user chose.
This commit is contained in:
German Khokhlov committed 2026-11-20 12:35:22 +04:00
1 parent 8eac8bd545
commit 06dccdb00f
3 files changed
+33 -2

No files matched your search

+10 -1
View File
@@ -311,6 +311,13 @@ export function createRecentImageryLayer({
return status !== 'empty' && status !== 'error';
}
/** A pick dropped for an empty day hands a deferred slot over now. */
function resumeHandover() {
if (!_handoverDeferred || pickWaiting()) return false;
syncRender();
return true;
}
/**
* A day whose probe came back empty leaves the map: JPEG products have no
* alpha and would drape black "no data" tiles. A pinned day is unpinned and
@@ -715,7 +722,7 @@ export function createRecentImageryLayer({
const key = activeSlotOf(candidate.key) ? null : candidate.key;
if (key === _previewKey) return;
if (key && !drapable(candidate)) {
_followKey = key;
if (availability(candidate) !== 'empty') _followKey = key;
return;
}
_pending = { key };
@@ -1088,6 +1095,7 @@ export function createRecentImageryLayer({
if (list[next].key === _focusKey) return;
_focusKey = list[next].key;
schedulePreviewFromFocus();
resumeHandover();
requestThumbnails();
notify();
},
@@ -1126,6 +1134,7 @@ export function createRecentImageryLayer({
if (!drapable(candidate)) {
clearPending();
_followKey = availability(candidate) === 'empty' ? null : candidate.key;
if (resumeHandover()) requestThumbnails();
notify();
return false;
}
+22
View File
@@ -1641,6 +1641,28 @@ test('a pick whose probe failed does not block the hand-over', async () => {
assert.equal(f.owned().a?.key, L16);
});
test('a pick dropped for an empty card lets a deferred hand-over go ahead at once', async () => {
const f = fixture();
await f.ready();
f.layer.setShowUnavailable(true);
f.thumbnails.probe(V21, 'empty');
f.layer.preview(V15);
f.thumbnails.probe(S18, 'empty');
assert.equal(f.owned().a, null, 'the pick keeps the slot while it is probed');
assert.equal(f.layer.preview(V21), false);
assert.equal(f.owned().a?.key, L16, 'a click on an empty card');
const g = fixture();
await g.ready();
g.layer.setShowUnavailable(true);
g.thumbnails.probe(V21, 'empty');
g.layer.preview(V15);
g.thumbnails.probe(S18, 'empty');
g.layer.focus(0);
assert.equal(g.owned().a?.key, L16, 'an arrow key onto an empty card');
assert.equal(g.snap().focus.key, V21, 'focus stays where the user put it');
assert.equal(g.diag().following, null, 'an empty day is not followed');
});
test('an arrow-key pick waiting out the debounce keeps Esri through an empty automatic result', async () => {
const controller = leasingController();
const f = fixture({ controller });