diff --git a/apps/client/src/widgets/type_widgets/Attachment.tsx b/apps/client/src/widgets/type_widgets/Attachment.tsx index 369844b5f..3fdc60e93 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") {