Refresh live Data Library datasets once older than cacheSeconds

A dataset layer loaded its features once and kept them until it was
removed: the parsed set survives disable/enable, so NWS alerts, GDACS and
EONET showed what they held when first switched on for the whole session.

A library dataset now asks the manager for a refresh every cacheSeconds.
Once its data is that old it loads again, and swaps the new set in only
when it is ready, so the old features stay drawn while the request runs
and stay if it fails. An enable after cacheSeconds also loads afresh.
Disable and destroy cancel a refresh in flight.
This commit is contained in:
Sameh Khamis committed 2026-11-12 15:48:14 -08:00
1 parent 1a2589d4ef
commit d58ba23fba
3 files changed
+227 -2

No files matched your search

+9
View File
@@ -1102,6 +1102,15 @@ export function createLocalGeoJsonLayer(
disable: disableLayer,
/**
* Forget the parsed features so the next enable() loads them again: a
* caller-owned live loader (the Data Library) uses it once its data is
* older than the source allows.
*/
dropCachedFeatures: () => {
_cachedFeatures = null;
},
destroy: (viewer) => {
if (_destroyed) return;
_destroyed = true;