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
feat(collection/presentation): use sync instead of full reload
Elian Doran4d772ab48dc8
diff --git a/apps/client/src/widgets/collections/presentation/index.tsx b/apps/client/src/widgets/collections/presentation/index.tsxindex 8ca32b17eb..856947e417 100644--- a/apps/client/src/widgets/collections/presentation/index.tsx+++ b/apps/client/src/widgets/collections/presentation/index.tsx@@ -72,7 +72,7 @@ function Presentation({ presentation, apiRef: externalApiRef } : { presentation:useEffect(() => {if (apiRef.current || !containerRef.current) return;- apiRef.current = new Reveal(containerRef.current, {+ const api = new Reveal(containerRef.current, {transition: "slide",embedded: true,keyboardCondition(event) {@@ -85,16 +85,18 @@ function Presentation({ presentation, apiRef: externalApiRef } : { presentation:},});externalApiRef.current = apiRef.current;- apiRef.current.initialize().then(() => {- // Initialization logic.+ api.initialize().then(() => {+ apiRef.current = api;});return () => {- if (apiRef.current) {- apiRef.current.destroy();- apiRef.current = null;- }+ api.destroy();+ apiRef.current = null;}+ }, [ ]);++ useEffect(() => {+ apiRef.current?.sync();}, [ presentation ]);return (