Don't crash when text field is not set (#147)

This commit is contained in:
Max 2025-02-22 16:49:50 +01:00 committed by GitHub
parent 0ec0f13c74
commit 1357a18b65
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,9 +17,7 @@ export const ProfileTextView = ({
}) => {
const text = get(item, dataField)
if (typeof text !== 'string') {
throw new Error('ProfileTextView: text is not a string')
}
const parsedText = typeof text !== 'string' ? '' : text
return (
<div className='tw-my-10 tw-mt-2 tw-px-6'>
@ -27,7 +25,7 @@ export const ProfileTextView = ({
<h2 className='tw-text-lg tw-font-semibold'>{heading}</h2>
)}
<div className='tw-mt-2 tw-text-sm'>
<TextView itemId={item.id} rawText={text} />
<TextView itemId={item.id} rawText={parsedText} />
</div>
</div>
)