From a82d15e83d5546cc572e72e05bce1605778e39c8 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 9 Nov 2025 14:26:32 +0200 Subject: [PATCH] fix(type_widgets/attachments): attachments not refreshing when uploading new revision --- apps/client/src/widgets/type_widgets/Attachment.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/client/src/widgets/type_widgets/Attachment.tsx b/apps/client/src/widgets/type_widgets/Attachment.tsx index 369844b5f7..3fdc60e932 100644 --- a/apps/client/src/widgets/type_widgets/Attachment.tsx +++ b/apps/client/src/widgets/type_widgets/Attachment.tsx @@ -129,12 +129,19 @@ export function AttachmentDetail({ note, viewScope }: TypeWidgetProps) { function AttachmentInfo({ attachment, isFullDetail }: { attachment: FAttachment, isFullDetail?: boolean }) { const contentWrapper = useRef(null); - useEffect(() => { + function refresh() { content_renderer.getRenderedContent(attachment, { imageHasZoom: isFullDetail }) .then(({ $renderedContent }) => { contentWrapper.current?.replaceChildren(...$renderedContent); - }) - }, [ attachment ]); + }); + } + + useEffect(refresh, [ attachment ]); + useTriliumEvent("entitiesReloaded", ({ loadResults }) => { + if (loadResults.getAttachmentRows().find(attachment => attachment.attachmentId)) { + refresh(); + } + }); async function copyAttachmentLinkToClipboard() { if (attachment.role === "image") {