mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 07:08:55 +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> }) {
|
function Presentation({ presentation, apiRef: externalApiRef } : { presentation: PresentationModel, apiRef: RefObject<Reveal.Api> }) {
|
||||||
const containerRef = useRef<HTMLDivElement>(null);
|
const containerRef = useRef<HTMLDivElement>(null);
|
||||||
const apiRef = useRef<Reveal.Api>(null);
|
const apiRef = useRef<Reveal.Api>(null);
|
||||||
|
const isFirstRenderRef = useRef(true);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (apiRef.current || !containerRef.current) return;
|
if (apiRef.current || !containerRef.current) return;
|
||||||
@ -96,7 +97,10 @@ function Presentation({ presentation, apiRef: externalApiRef } : { presentation:
|
|||||||
}, [ ]);
|
}, [ ]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
apiRef.current?.sync();
|
if (!isFirstRenderRef.current) {
|
||||||
|
apiRef.current?.sync();
|
||||||
|
}
|
||||||
|
isFirstRenderRef.current = false;
|
||||||
}, [ presentation ]);
|
}, [ presentation ]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user