Skip to content

Commit

Permalink
fix(informations): les références peuvent être null (#5458)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxgfr authored Dec 11, 2023
1 parent 8cb9d6b commit 15a8d5f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,22 @@ export const Contents = ({
return (
<>
<BlockList key={name} name={name} blocks={blocks}></BlockList>
{references.map(
({ label, links }, index) =>
links.length > 0 && (
<Section key={`section-${index}`}>
<References
label={label}
accordionDisplay={1}
references={links.map((reference, index) => ({
...reference,
id: reference.id || `${name}-${index}`,
}))}
/>
</Section>
)
)}
{references &&
references.map(
({ label, links }, index) =>
links.length > 0 && (
<Section key={`section-${index}`}>
<References
label={label}
accordionDisplay={1}
references={links.map((reference, index) => ({
...reference,
id: reference.id || `${name}-${index}`,
}))}
/>
</Section>
)
)}
</>
);
});
Expand Down
2 changes: 1 addition & 1 deletion packages/code-du-travail-utils/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export declare type Content = {
name: string;
title: string;
blocks: ContentBlock[];
references: Reference[];
references?: Reference[];
};

export type Breadcrumb = {
Expand Down

0 comments on commit 15a8d5f

Please sign in to comment.