Skip to content

Commit

Permalink
fix(app): specify component for markdown uls (#14997)
Browse files Browse the repository at this point in the history
When these are undefined, if react-markdown tries to render them it will
throw and that will crash the app. With these implemented with the same
StyledText passthrough as other text elements, it won't crash anymore -
though our styling rules aren't applied to the actual text in the ul.

Closes RQA-2566
Closes RQA-2587
  • Loading branch information
sfoster1 committed Apr 24, 2024
1 parent 972c970 commit 0493c5c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions app/src/molecules/ReleaseNotes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ export function ReleaseNotes(props: ReleaseNotesProps): JSX.Element {
<Markdown
components={{
div: undefined,
ul: undefined,
ul: UnnumberedListText,
h2: HeaderText,
li: ParagraphText,
li: ListItemText,
p: ParagraphText,
a: ExternalLink,
}}
Expand All @@ -47,3 +47,11 @@ function ParagraphText(props: JSX.IntrinsicAttributes): JSX.Element {
function HeaderText(props: JSX.IntrinsicAttributes): JSX.Element {
return <StyledText {...props} as="h3" />
}

function ListItemText(props: JSX.IntrinsicAttributes): JSX.Element {
return <StyledText {...props} as="li" />
}

function UnnumberedListText(props: JSX.IntrinsicAttributes): JSX.Element {
return <StyledText {...props} as="ul" />
}
2 changes: 1 addition & 1 deletion app/src/molecules/modals/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@
max-height: 100%;
overflow-y: auto;
padding-bottom: 3rem;
}
}

0 comments on commit 0493c5c

Please sign in to comment.