mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	feat(collection/presentation): use sync instead of full reload
This commit is contained in:
		| @@ -72,7 +72,7 @@ function Presentation({ presentation, apiRef: externalApiRef } : { presentation: | |||||||
|     useEffect(() => { |     useEffect(() => { | ||||||
|         if (apiRef.current || !containerRef.current) return; |         if (apiRef.current || !containerRef.current) return; | ||||||
|  |  | ||||||
|         apiRef.current = new Reveal(containerRef.current, { |         const api = new Reveal(containerRef.current, { | ||||||
|             transition: "slide", |             transition: "slide", | ||||||
|             embedded: true, |             embedded: true, | ||||||
|             keyboardCondition(event) { |             keyboardCondition(event) { | ||||||
| @@ -85,16 +85,18 @@ function Presentation({ presentation, apiRef: externalApiRef } : { presentation: | |||||||
|             }, |             }, | ||||||
|         }); |         }); | ||||||
|         externalApiRef.current = apiRef.current; |         externalApiRef.current = apiRef.current; | ||||||
|         apiRef.current.initialize().then(() => { |         api.initialize().then(() => { | ||||||
|             // Initialization logic. |             apiRef.current = api; | ||||||
|         }); |         }); | ||||||
|  |  | ||||||
|         return () => { |         return () => { | ||||||
|             if (apiRef.current) { |             api.destroy(); | ||||||
|                 apiRef.current.destroy(); |             apiRef.current = null; | ||||||
|                 apiRef.current = null; |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
|  |     }, [ ]); | ||||||
|  |  | ||||||
|  |     useEffect(() => { | ||||||
|  |         apiRef.current?.sync(); | ||||||
|     }, [ presentation ]); |     }, [ presentation ]); | ||||||
|  |  | ||||||
|     return ( |     return ( | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user