MCPcopy Create free account
hub / github.com/Thanas-R/Virdis / fetchTs

Function fetchTs

src/components/WeatherView.tsx:209–228  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

207 setNdviTimeSeries(cached);
208 return;
209 }
210 const fetchTs = async () => {
211 setNdviTsLoading(true);
212 try {
213 const polygon = effectiveField.coordinates[0];
214 const data = await invokeWithRetry<any>(
215 "ndvi-timeseries",
216 { polygon },
217 { retries: 4, isEmpty: (d) => !hasNdviPayload(d) }
218 );
219 if (hasNdviPayload(data)) {
220 setNdviTimeSeries(data);
221 setLocalCache(GEE_ANALYTICS_CACHE_KEY, cacheKey, data);
222 } else {
223 setNdviTimeSeries(cached ?? null);
224 }
225 } catch (e) {
226 console.error("NDVI time-series error:", e);
227 setNdviTimeSeries(cached ?? null);
228 } finally { setNdviTsLoading(false); }
229 };
230 fetchTs();
231 }, [effectiveField?.id]);

Callers 1

WeatherViewFunction · 0.70

Calls 2

hasNdviPayloadFunction · 0.90
setLocalCacheFunction · 0.90

Tested by

no test coverage detected