From 15a8d5fa4a32cc2e74bcbddcb476f1a928c119b5 Mon Sep 17 00:00:00 2001
From: Maxime Golfier <25312957+maxgfr@users.noreply.github.com>
Date: Mon, 11 Dec 2023 10:43:53 +0100
Subject: [PATCH] =?UTF-8?q?fix(informations):=20les=20r=C3=A9f=C3=A9rences?=
=?UTF-8?q?=20peuvent=20=C3=AAtre=20`null`=20(#5458)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/information/Components/Contents.tsx | 31 ++++++++++---------
packages/code-du-travail-utils/src/types.ts | 2 +-
2 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/packages/code-du-travail-frontend/src/information/Components/Contents.tsx b/packages/code-du-travail-frontend/src/information/Components/Contents.tsx
index bb18dec0c4..58678f5dcf 100644
--- a/packages/code-du-travail-frontend/src/information/Components/Contents.tsx
+++ b/packages/code-du-travail-frontend/src/information/Components/Contents.tsx
@@ -26,21 +26,22 @@ export const Contents = ({
return (
<>
- {references.map(
- ({ label, links }, index) =>
- links.length > 0 && (
-
- ({
- ...reference,
- id: reference.id || `${name}-${index}`,
- }))}
- />
-
- )
- )}
+ {references &&
+ references.map(
+ ({ label, links }, index) =>
+ links.length > 0 && (
+
+ ({
+ ...reference,
+ id: reference.id || `${name}-${index}`,
+ }))}
+ />
+
+ )
+ )}
>
);
});
diff --git a/packages/code-du-travail-utils/src/types.ts b/packages/code-du-travail-utils/src/types.ts
index 65d7e9fd8c..0637a07898 100644
--- a/packages/code-du-travail-utils/src/types.ts
+++ b/packages/code-du-travail-utils/src/types.ts
@@ -68,7 +68,7 @@ export declare type Content = {
name: string;
title: string;
blocks: ContentBlock[];
- references: Reference[];
+ references?: Reference[];
};
export type Breadcrumb = {