From f0afbca74bded9455450f9e6a4fe27b08c17df7b Mon Sep 17 00:00:00 2001 From: MayaTheShy Date: Fri, 20 Feb 2026 01:31:40 -0500 Subject: [PATCH] fix: Handle server response for mining areas; ensure areas state is set correctly for non-array responses --- client/src/components/MiningAreasPanel.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/src/components/MiningAreasPanel.jsx b/client/src/components/MiningAreasPanel.jsx index 8687555..aedc903 100644 --- a/client/src/components/MiningAreasPanel.jsx +++ b/client/src/components/MiningAreasPanel.jsx @@ -28,7 +28,8 @@ export default function MiningAreasPanel({ turtles, selectedTurtle, apiUrl }) { const response = await fetch(`${apiUrl}/api/mining-areas`); if (response.ok) { const data = await response.json(); - setAreas(data); + // Server returns a flat array of formatted areas + setAreas(Array.isArray(data) ? data : (data.areas || [])); } } catch (error) { console.error('Failed to load mining areas:', error);