From 3c5e0855d7cb44904fea643e7699cbf6e3c0e56b Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Wed, 15 Oct 2025 22:51:03 +0300 Subject: [PATCH] fix(collection/presentation): math equations rendering twice --- .../src/widgets/collections/presentation/index.tsx | 14 ++++++++++++-- .../widgets/collections/presentation/slidejs.css | 4 ++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/apps/client/src/widgets/collections/presentation/index.tsx b/apps/client/src/widgets/collections/presentation/index.tsx index b384b0220..c25d0678f 100644 --- a/apps/client/src/widgets/collections/presentation/index.tsx +++ b/apps/client/src/widgets/collections/presentation/index.tsx @@ -10,6 +10,7 @@ import ActionButton from "../../react/ActionButton"; import "./index.css"; import { RefObject } from "preact"; import { openInCurrentNoteContext } from "../../../components/note_context"; +import { useTriliumEvent } from "../../react/hooks"; const stylesheets = [ slideBaseStylesheet, @@ -22,9 +23,18 @@ export default function PresentationView({ note, noteIds }: ViewModeProps<{}>) { const containerRef = useRef(null); const apiRef = useRef(null); - useLayoutEffect(() => { + function refresh() { buildPresentationModel(note).then(setPresentation); - }, [ note, noteIds ]); + } + + useTriliumEvent("entitiesReloaded", ({ loadResults }) => { + if (loadResults.getNoteIds().find(noteId => noteIds.includes(noteId))) { + console.log("Needs reload!"); + refresh(); + } + }); + + useLayoutEffect(refresh, [ note, noteIds ]); return presentation && ( <> diff --git a/apps/client/src/widgets/collections/presentation/slidejs.css b/apps/client/src/widgets/collections/presentation/slidejs.css index 6fd846f0b..25363245c 100644 --- a/apps/client/src/widgets/collections/presentation/slidejs.css +++ b/apps/client/src/widgets/collections/presentation/slidejs.css @@ -1,4 +1,8 @@ figure img { aspect-ratio: unset !important; height: auto !important; +} + +[aria-hidden=true] { + display: none !important; } \ No newline at end of file