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

Callers 1

WeatherViewFunction · 0.70

Calls 2

hasNdviPayloadFunction · 0.90
setLocalCacheFunction · 0.90

Tested by

no test coverage detected