From d41d1b054dbdd2ce43b934c41f51f75d43a40332 Mon Sep 17 00:00:00 2001 From: Carlos Valente Date: Sat, 16 Mar 2024 09:33:55 +0100 Subject: [PATCH] fix: reset focus when deleting all --- .../src/features/rundown/rundown-header/RundownMenu.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/client/src/features/rundown/rundown-header/RundownMenu.tsx b/apps/client/src/features/rundown/rundown-header/RundownMenu.tsx index cdc556f00..ef409e266 100644 --- a/apps/client/src/features/rundown/rundown-header/RundownMenu.tsx +++ b/apps/client/src/features/rundown/rundown-header/RundownMenu.tsx @@ -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 (