From 4d772ab48dc856312c508e8df296482aa8e5d7f6 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Wed, 15 Oct 2025 22:34:01 +0300 Subject: [PATCH] feat(collection/presentation): use sync instead of full reload --- .../widgets/collections/presentation/index.tsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/apps/client/src/widgets/collections/presentation/index.tsx b/apps/client/src/widgets/collections/presentation/index.tsx index 8ca32b17e..856947e41 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 (