fix(wildlife): draw what arrived when one sighting source fails

An iNaturalist rejection discarded a successful Acartia reply, and the
antimeridian Promise.all lost both halves when one failed. Each box now
settles independently; the failed part is reported on
sources.inaturalist (error and failed boxes), the layer keeps that
area's last iNaturalist rows and shows DEGRADED with retry timing, and
the update fails outright only when every requested source failed.
This commit is contained in:
Sameh Khamis committed 2026-11-05 16:06:41 -08:00
1 parent 3cb30c3f97
commit 5391687d46
5 files changed
+155 -5

No files matched your search

+15 -1
View File
@@ -345,8 +345,18 @@ export function createLifecycle({ state, services, parts }) {
state.loadedScope = query.scope;
state.pendingClear = false;
// A successful page replaces this queried area, including a healthy
// empty page. Keep only other visited areas in the bounded LRU.
// empty page. Keep only other visited areas in the bounded LRU. Areas
// whose iNaturalist request failed keep their last iNaturalist rows.
const inat = snapshot.sources?.inaturalist;
const failedInatBoxes =
inat?.ok === false ? inat.failedBoxes || query.boxes : null;
for (const [id, row] of state.rows) {
if (
failedInatBoxes &&
row.origin === 'inaturalist' &&
rowInWildlifeBoxes(row, failedInatBoxes, 0)
)
continue;
if (rowInWildlifeBoxes(row, query.boxes, 0)) state.rows.delete(id);
}
for (const row of snapshot.rows) {
@@ -397,6 +407,10 @@ export function createLifecycle({ state, services, parts }) {
const sourceError =
gridError ||
staleError ||
(snapshot.sources?.inaturalist?.ok === false
? snapshot.sources.inaturalist.error ||
new Error(msg('Wildlife sightings source unavailable'))
: null) ||
(snapshot.sources?.acartia?.ok === false
? new Error(msg('Acartia feed unavailable'))
: null);