mirror of
https://github.com/zadam/trilium.git
synced 2025-10-19 22:58:52 +02:00
chore(collection/presentation): don't sync on first render
This commit is contained in:
parent
4d772ab48d
commit
f33fe4266a
@ -68,6 +68,7 @@ function ButtonOverlay({ containerRef, apiRef }: { containerRef: RefObject<HTMLD
|
||||
function Presentation({ presentation, apiRef: externalApiRef } : { presentation: PresentationModel, apiRef: RefObject<Reveal.Api> }) {
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
const apiRef = useRef<Reveal.Api>(null);
|
||||
const isFirstRenderRef = useRef(true);
|
||||
|
||||
useEffect(() => {
|
||||
if (apiRef.current || !containerRef.current) return;
|
||||
@ -96,7 +97,10 @@ function Presentation({ presentation, apiRef: externalApiRef } : { presentation:
|
||||
}, [ ]);
|
||||
|
||||
useEffect(() => {
|
||||
apiRef.current?.sync();
|
||||
if (!isFirstRenderRef.current) {
|
||||
apiRef.current?.sync();
|
||||
}
|
||||
isFirstRenderRef.current = false;
|
||||
}, [ presentation ]);
|
||||
|
||||
return (
|
||||
|
Loading…
x
Reference in New Issue
Block a user