diff --git a/src/components/v2-pre/FormattedText.tsx b/src/components/v2-pre/FormattedText.tsx index 4dc962af..a14587c9 100644 --- a/src/components/v2-pre/FormattedText.tsx +++ b/src/components/v2-pre/FormattedText.tsx @@ -6,6 +6,9 @@ interface FormattedTextProps { } const FormattedText = ({ children }: FormattedTextProps) => { + if (children == null) { + children = '' + } const tokens = tokenize(children) return <>{renderTokens(tokens)} diff --git a/src/lib/v2-pre/data/formatText.ts b/src/lib/v2-pre/data/formatText.ts index 4a73780e..69075b9c 100644 --- a/src/lib/v2-pre/data/formatText.ts +++ b/src/lib/v2-pre/data/formatText.ts @@ -64,7 +64,10 @@ export function formatSubSkillInfo({ ) } -export function replaceNewLine(value: string = '') { +export function replaceNewLine(value: string) { + if (value == null) { + value = '' + } return value.replace(/\\n/g, '\n') }