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

Function fetchTs

src/components/FieldComparisonColumn.tsx:128–148  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

126 }
127 const fetchTs = async () => {
128 setNdviTsLoading(true);
129 try {
130 const polygon = field.coordinates[0];
131 const { data, error } = await callBackend("ndvi-timeseries", { polygon });
132 if (error) throw error;
133 if (hasNdviPayload(data)) {
134 setNdviTimeSeries(data);
135 setLocalCache(GEE_ANALYTICS_CACHE_KEY, cacheKey, data);
136 } else if (isFallbackPayload(data)) {
137 setNdviTimeSeries(cached ?? null);
138 } else {
139 setNdviTimeSeries(null);
140 }
141 } catch (e) {
142 console.error("NDVI time-series error:", e);
143 setNdviTimeSeries(cached ?? null);
144 } finally { setNdviTsLoading(false); }
145 };
146 fetchTs();
147 }, [field.id]);
148
149 // Fetch weather data
150 useEffect(() => {
151 const fetchWeatherData = async () => {

Callers 1

FieldComparisonColumnFunction · 0.70

Calls 3

hasNdviPayloadFunction · 0.90
setLocalCacheFunction · 0.90
isFallbackPayloadFunction · 0.90

Tested by

no test coverage detected