Skip to content

Commit

Permalink
Prevent crashes when missing Strapi data
Browse files Browse the repository at this point in the history
  • Loading branch information
clementprdhomme committed Oct 16, 2024
1 parent 761ffc4 commit 696c5ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const BoundariesPopup: FCWithMessages<{ layerId: number }> = ({ layerId }) => {
placeholderData: { data: {} },
select: ({ data }) => ({
source: (data.attributes as LayerTyped)?.config?.source,
environment: data.attributes?.environment?.data.attributes.slug,
environment: data.attributes?.environment?.data?.attributes.slug,
}),
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,12 @@ const HabitatWidget: FCWithMessages<HabitatWidgetProps> = ({ location }) => {
)?.attributes;
}

const metadata = habitatMetadatas?.find(({ slug }) => slug === habitat.slug);
const metadata = habitatMetadatas?.find(({ slug }) => slug === habitat?.slug);

return {
title: habitat.name,
slug: habitat.slug,
background: HABITAT_CHART_COLORS[habitat.slug],
title: habitat?.name,
slug: habitat?.slug,
background: HABITAT_CHART_COLORS[habitat?.slug],
totalArea: stats.total_area,
protectedArea: stats.protected_area,
info: metadata?.info,
Expand Down

0 comments on commit 696c5ec

Please sign in to comment.