1 import { useEffect, useMemo } from 'react';
3 import { useCalendarModelEventManager } from '@proton/components';
4 import type { VisualCalendar } from '@proton/shared/lib/interfaces/calendar';
6 const usePauseCalendarEventLoop = (activeCalendars: VisualCalendar[], condition: boolean) => {
7 const { start, stop } = useCalendarModelEventManager();
8 const calendarIDs = useMemo(() => activeCalendars.map(({ ID }) => ID), [activeCalendars]);
11 if (!calendarIDs.length) {
16 // Pause calendar event loop
19 // Resume calendar event loop
22 }, [condition, calendarIDs]);
25 export default usePauseCalendarEventLoop;