From 54a2c67f47e3f82380f3880f5b92d0c0efa3b88d Mon Sep 17 00:00:00 2001 From: Florian Sommariva <1926041+dtrucs@users.noreply.github.com> Date: Thu, 10 Oct 2024 10:24:14 +0200 Subject: [PATCH] Fix annotations viewpoint with no features --- frontend/src/modules/viewPoint/adapter.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/frontend/src/modules/viewPoint/adapter.ts b/frontend/src/modules/viewPoint/adapter.ts index c1652c515..489787cd2 100644 --- a/frontend/src/modules/viewPoint/adapter.ts +++ b/frontend/src/modules/viewPoint/adapter.ts @@ -27,13 +27,14 @@ export const adaptViewPoints = async ( return { annotations: { ...viewpoint.annotations, - features: viewpoint.annotations.features.map(feature => ({ - ...feature, - properties: { - ...feature.properties, - category: categories?.[feature.properties?.category] || null, - }, - })), + features: + viewpoint.annotations.features?.map(feature => ({ + ...feature, + properties: { + ...feature.properties, + category: categories?.[feature.properties?.category] || null, + }, + })) ?? [], }, id: String(viewpoint.id), author: viewpoint.author,