fix(notifications) Fix case when description is react component instance (#13919)

This commit is contained in:
Horatiu Muresan
2023-10-06 15:20:56 +03:00
committed by GitHub
parent a7af01b9e3
commit a4d3fb6c70

View File

@@ -208,7 +208,7 @@ const Notification = ({
descriptionKey
&& descriptionArray.push(t(descriptionKey, descriptionArguments));
description && descriptionArray.push(description);
description && typeof description === 'string' && descriptionArray.push(description);
// Keeping in mind that:
// - Notifications that use the `translateToHtml` function get an element-based description array with one entry
@@ -219,11 +219,12 @@ const Notification = ({
// the id is used for testing the UI
return (
<p
<div
className = { classes.description }
data-testid = { descriptionKey } >
{shouldRenderHtml ? descriptionArray : <Message text = { descriptionArray.join(' ') } />}
</p>
{typeof description === 'object' && description}
</div>
);
}, [ description, descriptionArguments, descriptionKey, classes ]);