Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix(attachment): doesn't react to title change
Elian Doranbbfdbba8e6fa
diff --git a/apps/client/src/widgets/type_widgets/Attachment.tsx b/apps/client/src/widgets/type_widgets/Attachment.tsxindex 0d09749c15..26694049bd 100644--- a/apps/client/src/widgets/type_widgets/Attachment.tsx+++ b/apps/client/src/widgets/type_widgets/Attachment.tsx@@ -142,6 +142,7 @@ export function AttachmentDetail({ note, viewScope }: TypeWidgetProps) {function AttachmentInfo({ attachment, isFullDetail }: { attachment: FAttachment, isFullDetail?: boolean }) {const contentWrapper = useRef<HTMLDivElement>(null);const [ ocrModalShown, setOcrModalShown ] = useState(false);+ const [ title, setTitle ] = useState(attachment.title);const [ textContent, setTextContent ] = useState<string | null>(null);const supportsOcr = attachment.role === "image" || attachment.role === "file";@@ -154,6 +155,8 @@ function AttachmentInfo({ attachment, isFullDetail }: { attachment: FAttachment,if (attachment.role === "file") {attachment.getBlob().then(blob => setTextContent(blob?.content ?? null));}++ setTitle(attachment.title);}useEffect(refresh, [ attachment ]);@@ -197,13 +200,13 @@ function AttachmentInfo({ attachment, isFullDetail }: { attachment: FAttachment,{!isFullDetail ? (<NoteLinknotePath={attachment.ownerId}- title={attachment.title}+ title={title}viewScope={{viewMode: "attachments",attachmentId: attachment.attachmentId}}/>- ) : (attachment.title)}+ ) : title}</h4><div className="attachment-details">{t("attachment_detail_2.role_and_size", {