mirror of
https://github.com/TriliumNext/Trilium.git
synced 2025-12-10 21:07:05 -06:00
feat(react/collections/calendar): improve performance on option change
This commit is contained in:
parent
8dcef5ea9f
commit
5a3f432d89
@ -1,4 +1,4 @@
|
|||||||
import { useLayoutEffect, useRef } from "preact/hooks";
|
import { useEffect, useLayoutEffect, useRef } from "preact/hooks";
|
||||||
import { CalendarOptions, Calendar as FullCalendar, PluginDef } from "@fullcalendar/core";
|
import { CalendarOptions, Calendar as FullCalendar, PluginDef } from "@fullcalendar/core";
|
||||||
import { RefObject } from "preact";
|
import { RefObject } from "preact";
|
||||||
|
|
||||||
@ -20,7 +20,11 @@ export default function Calendar({ calendarRef, ...options }: CalendarProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return () => calendar.destroy();
|
return () => calendar.destroy();
|
||||||
}, [ containerRef, options ]);
|
}, [ ]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
calendarRef?.current?.resetOptions(options);
|
||||||
|
}, [ options ]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div ref={containerRef} className="calendar-container" />
|
<div ref={containerRef} className="calendar-container" />
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user