fix: avoid "Imported from undefined" in document insights (#12378)

Only render the "Imported from" line when a source name or filename is
actually available, since sourceMetadata can exist without either.
This commit is contained in:
Tom Moor
2026-05-18 20:08:12 -04:00
committed by GitHub
parent a60d02898e
commit 4a6e94be3f
+3 -2
View File
@@ -58,12 +58,13 @@ function Insights({ document }: Props) {
{t(`Last updated`)}{" "}
<Time dateTime={document.updatedAt} addSuffix />
</li>
{document.sourceMetadata && (
{(document.sourceName ||
document.sourceMetadata?.fileName) && (
<li>
{t("Imported from {{ source }}", {
source:
document.sourceName ??
`${document.sourceMetadata.fileName}`,
`${document.sourceMetadata?.fileName}`,
})}
</li>
)}