diff --git a/frontend/src/pages/Properties/PropertyDetail.js b/frontend/src/pages/Properties/PropertyDetail.js index 1bcbf15..a2224ec 100644 --- a/frontend/src/pages/Properties/PropertyDetail.js +++ b/frontend/src/pages/Properties/PropertyDetail.js @@ -661,13 +661,13 @@ const PropertyDetail = () => { const response = await propertiesAPI.createSection(id, sectionData); const savedSection = response.data.data.section; - - // Convert backend format to frontend format + // Convert backend format to frontend format; parse polygonData if string + const poly = typeof savedSection.polygonData === 'string' ? JSON.parse(savedSection.polygonData) : savedSection.polygonData; const newSection = { id: savedSection.id, name: savedSection.name, - coordinates: savedSection.polygonData.coordinates[0], - color: savedSection.polygonData.color, + coordinates: poly?.coordinates?.[0] || [], + color: poly?.color || currentColor, area: savedSection.area, grassType: savedSection.grassType || '', grassTypes: savedSection.grassTypes || []