diff --git a/apps/client/src/common/hooks/useEntryAction.ts b/apps/client/src/common/hooks/useEntryAction.ts index c47e65226..71ca376f1 100644 --- a/apps/client/src/common/hooks/useEntryAction.ts +++ b/apps/client/src/common/hooks/useEntryAction.ts @@ -60,6 +60,7 @@ export type EventOptions = Partial<{ before: MaybeString; // options of entries of type OntimeEvent linkPrevious: boolean; + /** the timing reference for the new entry, usually the same as after */ lastEventId: MaybeString; }>; @@ -205,8 +206,8 @@ function useEntryActionsForRundown(scopedRundownId: string | undefined) { // ************* CHECK OPTIONS specific to events if (isOntimeEvent(newEntry)) { + // last event id is the timing reference of the previous OntimeEvent in rundown if (options?.lastEventId) { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- we know this is a value const previousEvent = rundownData.entries[options?.lastEventId]; if (isOntimeEvent(previousEvent)) { newEntry.timeStart = previousEvent.timeEnd; diff --git a/apps/client/src/features/rundown/hooks/useRundownCommands.ts b/apps/client/src/features/rundown/hooks/useRundownCommands.ts index c4b2eb4d6..e036aa1ce 100644 --- a/apps/client/src/features/rundown/hooks/useRundownCommands.ts +++ b/apps/client/src/features/rundown/hooks/useRundownCommands.ts @@ -96,7 +96,7 @@ export function useRundownCommands({ addEntry(patch, { after: id && !above ? id : undefined, before: id && above ? id : undefined, - lastEventId: !above && id ? id : undefined, + lastEventId: id && !above ? id : undefined, }); }, [addEntry],