mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-15 15:52:21 +00:00
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:
1 parent
3cb30c3f97
commit
5391687d46
5 files changed
+155
-5
No files matched your search
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user