diff --git a/apps/client/src/common/hooks/useEntryAction.ts b/apps/client/src/common/hooks/useEntryAction.ts index 0f8d78673..e00d020f8 100644 --- a/apps/client/src/common/hooks/useEntryAction.ts +++ b/apps/client/src/common/hooks/useEntryAction.ts @@ -7,7 +7,6 @@ import { MaybeString, OntimeEntry, OntimeEvent, - OntimeGroup, Rundown, SupportedEntry, TimeField, @@ -803,10 +802,8 @@ function optimisticDeleteEntries(entryIds: EntryId[], rundown: Rundown) { order = order.filter((id) => id !== entry.id); } else { const parent = entries[entry.parent]; - if ('parent' in entries) { - (parent as OntimeGroup).entries = (parent as OntimeGroup).entries.filter( - (parentEntry) => parentEntry !== entry.id, - ); + if (parent && isOntimeGroup(parent)) { + parent.entries = parent.entries.filter((parentEntry) => parentEntry !== entry.id); } } diff --git a/apps/client/src/features/rundown/rundown.utils.ts b/apps/client/src/features/rundown/rundown.utils.ts index 8f4cd24ab..88e07d12d 100644 --- a/apps/client/src/features/rundown/rundown.utils.ts +++ b/apps/client/src/features/rundown/rundown.utils.ts @@ -160,7 +160,7 @@ export function makeSortableList(order: EntryId[], entries: RundownEntries): Ent * Checks whether a drop operation is valid * Currently only used for validating dropping groups */ -export function canDrop(targetType?: SupportedEntry & 'end-group', targetParent?: EntryId | null): boolean { +export function canDrop(targetType?: SupportedEntry | 'end-group', targetParent?: EntryId | null): boolean { // this would mean inserting a group inside another if (targetType === 'end-group') { return false; diff --git a/apps/client/src/features/rundown/useEventSelection.ts b/apps/client/src/features/rundown/useEventSelection.ts index 1c646d728..bd4dfb247 100644 --- a/apps/client/src/features/rundown/useEventSelection.ts +++ b/apps/client/src/features/rundown/useEventSelection.ts @@ -103,7 +103,11 @@ export const useEventSelection = create()((set, get) => ({ clearMultiSelect: () => { const { selectedEvents } = get(); const [firstSelected] = selectedEvents; - set({ selectedEvents: new Set(firstSelected || undefined), anchoredIndex: null, entryMode: null }); + set({ + selectedEvents: new Set(firstSelected ? [firstSelected] : []), + anchoredIndex: null, + entryMode: null, + }); }, unselect: (id: string) => { const { entryMode, selectedEvents } = get(); diff --git a/apps/client/src/views/cuesheet/cuesheet-table/cuesheet-table-elements/CuesheetBody.tsx b/apps/client/src/views/cuesheet/cuesheet-table/cuesheet-table-elements/CuesheetBody.tsx index 8ad181bfb..222571b43 100644 --- a/apps/client/src/views/cuesheet/cuesheet-table/cuesheet-table-elements/CuesheetBody.tsx +++ b/apps/client/src/views/cuesheet/cuesheet-table/cuesheet-table-elements/CuesheetBody.tsx @@ -87,8 +87,8 @@ export default function CuesheetBody({ rowModel, selectedRef, table }: CuesheetB let parentBgColour: string | null = null; if (entry.parent) { const rundown = queryClient.getQueryData(RUNDOWN); - const parentEntry = rundown?.entries[entry.parent]; - parentBgColour = (parentEntry as OntimeGroup).colour ?? null; + const parentEntry = rundown?.entries[entry.parent] as OntimeGroup | undefined; + parentBgColour = parentEntry?.colour ?? null; } return ; } diff --git a/apps/server/src/stores/runtimeState.ts b/apps/server/src/stores/runtimeState.ts index 9e2c14a24..8b6d19cb4 100644 --- a/apps/server/src/stores/runtimeState.ts +++ b/apps/server/src/stores/runtimeState.ts @@ -771,7 +771,7 @@ export function loadGroupFlagAndEnd( currentIndex: MaybeNumber, state = runtimeState, ) { - if (currentIndex === null) return resetMetaData(); + if (currentIndex == null) return resetMetaData(); if (state.eventNow === null) return resetMetaData(); const currentGroupId = state.eventNow.parent;