fix: close editor on event delete

This commit is contained in:
cv
2023-04-06 14:10:23 +02:00
parent 2dcea86b36
commit 4c4b83979d
@@ -8,12 +8,14 @@ import { SupportedEvent } from 'ontime-types';
import { useEventAction } from '../../common/hooks/useEventAction'; import { useEventAction } from '../../common/hooks/useEventAction';
import { useCursor } from '../../common/stores/cursorStore'; import { useCursor } from '../../common/stores/cursorStore';
import { useEventEditorStore } from '../../common/stores/eventEditor';
import style from './RundownMenu.module.scss'; import style from './RundownMenu.module.scss';
const RundownMenu = () => { const RundownMenu = () => {
const isCursorLocked = useCursor((state) => state.isCursorLocked); const isCursorLocked = useCursor((state) => state.isCursorLocked);
const toggleCursorLocked = useCursor((state) => state.toggleCursorLocked); const toggleCursorLocked = useCursor((state) => state.toggleCursorLocked);
const removeOpenEvent = useEventEditorStore((state) => state.removeOpenEvent);
const { addEvent, deleteAllEvents } = useEventAction(); const { addEvent, deleteAllEvents } = useEventAction();
@@ -31,7 +33,8 @@ const RundownMenu = () => {
const deleteAll = useCallback(() => { const deleteAll = useCallback(() => {
deleteAllEvents(); deleteAllEvents();
}, [deleteAllEvents]); removeOpenEvent();
}, [deleteAllEvents, removeOpenEvent]);
return ( return (
<HStack className={style.headerButtons}> <HStack className={style.headerButtons}>