chore: check the legacy incompatible message type (#3248)

This commit is contained in:
Louis 2024-08-05 11:43:15 +07:00 committed by GitHub
parent f0f23078f3
commit c10caf8d7f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -61,7 +61,9 @@ const SimpleTextMessage: React.FC<Props> = ({
const message = msg.content[0] const message = msg.content[0]
if (message && message.type === 'text') { if (message && message.type === 'text') {
const textBlockContent = message as TextContentBlock const textBlockContent = message as TextContentBlock
setText(textBlockContent.text.value) // Check for compatible message object type - There was a problem with legacy message object compatibility, which broke the app.
if (typeof textBlockContent.text.value === 'string')
setText(textBlockContent.text.value)
} }
} }
}, [msg.content]) }, [msg.content])