fill Dependency List

This commit is contained in:
alex-arc
2026-04-03 17:16:11 +02:00
parent 50ae9640f3
commit 3ddf61c651
+22 -14
View File
@@ -371,19 +371,6 @@ function useEntryActionsForRundown(scopedRundownId: string | undefined) {
[getCurrentRundownData, updateEntryMutation],
);
const matchGroupDuration = useCallback(async (eventId: EntryId, groupId: EntryId) => {
const rundown = queryClient.getQueryData<Rundown>(RUNDOWN);
if (!rundown) return;
const group = rundown.entries[groupId];
if (!group || !isOntimeGroup(group) || group.targetDuration === null) return;
const event = rundown.entries[eventId];
if (!event || !isOntimeEvent(event)) return;
const durationDiff = group.targetDuration - group.duration;
const newDuration = event.duration + durationDiff;
if (newDuration < 0) return;
updateTimer(eventId, 'duration', String(newDuration / MILLIS_PER_SECOND) + 's', false);
}, []);
/**
* Updates time of existing event
* @param eventId {EntryId} - id of the event
@@ -479,7 +466,28 @@ function useEntryActionsForRundown(scopedRundownId: string | undefined) {
return previousEnd;
}
},
[getCurrentRundownData, updateEntryMutation, queryClient],
[getCurrentRundownData, updateEntryMutation, queryClient, resolveCurrentRundownQueryKey],
);
/**
* Updates time of existing event so it satisfies the group target duration
* @param eventId {EntryId} - id of the event
* @param groupId {EntryId} - id of the enclosing group
*/
const matchGroupDuration = useCallback(
async (eventId: EntryId, groupId: EntryId) => {
const rundown = queryClient.getQueryData<Rundown>(resolveCurrentRundownQueryKey());
if (!rundown) return;
const group = rundown.entries[groupId];
if (!group || !isOntimeGroup(group) || group.targetDuration === null) return;
const event = rundown.entries[eventId];
if (!event || !isOntimeEvent(event)) return;
const durationDiff = group.targetDuration - group.duration;
const newDuration = event.duration + durationDiff;
if (newDuration < 0) return;
updateTimer(eventId, 'duration', String(newDuration / MILLIS_PER_SECOND) + 's', false);
},
[queryClient, updateTimer, resolveCurrentRundownQueryKey],
);
/**