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

Function fetchSoil

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

Source from the content-addressed store, hash-verified

248 setSoilData(cached);
249 }
250 const fetchSoil = async () => {
251 try {
252 const { lat, lng } = getFieldCenter(effectiveField);
253 const data = await invokeWithRetry<any>(
254 "soil-data",
255 { lat, lon: lng },
256 { retries: 3, isEmpty: (d) => !hasSoilPayload(d) }
257 );
258 if (hasSoilPayload(data)) {
259 setSoilData(data);
260 setLocalCache(SOIL_CACHE_KEY, effectiveField.id, data);
261 } else {
262 setSoilData(cached ?? null);
263 }
264 } catch (e) { console.error("Soil data for planning error:", e); setSoilData(cached ?? null); }
265 };
266 fetchSoil();
267 }, [effectiveField?.id]);
268

Callers 1

WeatherViewFunction · 0.70

Calls 3

hasSoilPayloadFunction · 0.90
setLocalCacheFunction · 0.90
getFieldCenterFunction · 0.70

Tested by

no test coverage detected