fix: reset focus when deleting all

This commit is contained in:
Carlos Valente
2024-03-16 09:33:55 +01:00
committed by Carlos Valente
parent 8b6e06150a
commit d41d1b054d
@@ -7,11 +7,12 @@ import { IoTrashOutline } from '@react-icons/all-files/io5/IoTrashOutline';
import { SupportedEvent } from 'ontime-types';
import { useEventAction } from '../../../common/hooks/useEventAction';
import { useAppMode } from '../../../common/stores/appModeStore';
import { useEventSelection } from '../useEventSelection';
const RundownMenu = ({ children }: { children: ReactNode }) => {
const { clearSelectedEvents } = useEventSelection();
const clearSelectedEvents = useEventSelection((state) => state.clearSelectedEvents);
const setCursor = useAppMode((state) => state.setCursor);
const { addEvent, deleteAllEvents } = useEventAction();
const newEvent = useCallback(() => {
@@ -29,8 +30,8 @@ const RundownMenu = ({ children }: { children: ReactNode }) => {
const deleteAll = useCallback(() => {
deleteAllEvents();
clearSelectedEvents();
// setCursor(null);
}, [deleteAllEvents, clearSelectedEvents]);
setCursor(null);
}, [clearSelectedEvents, deleteAllEvents, setCursor]);
return (
<Menu isLazy lazyBehavior='unmount' variant='ontime-on-dark' placement='right-start'>