mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-31 20:09:11 +00:00
fix(rundown): narrow rundown invalidation
Two independent issues in the revision strategy. The client guard only skipped a refetch when the revision matched exactly, while its comment described skipping anything not newer. A message which arrives after a refetch has already brought in a later revision forced a needless refetch. Compare with <= so the guard does what it claims. Renaming a rundown re-initialised it, which stops playback. Renaming the loaded rundown during a show therefore stopped the show. A title has no bearing on the schedule, so it now goes through an ordinary transaction: the title is persisted, the revision bumped and clients notified, with no runtime involvement. Renaming to the current title is a no-op. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011a5cbVjNC5XXF88b2PkUCa
This commit is contained in:
@@ -816,27 +816,23 @@ export async function createNewRundown(title: string) {
|
||||
* @throws if the provided id does not exist
|
||||
*/
|
||||
export async function renameRundown(id: string, title: string) {
|
||||
const dataProvider = getDataProvider();
|
||||
const rundown = dataProvider.getRundown(id);
|
||||
const { rundown, commit } = createTransaction({ rundownId: id, mutableRundown: true });
|
||||
|
||||
await dataProvider.setRundown(id, { ...rundown, title, revision: rundown.revision + 1 });
|
||||
|
||||
/**
|
||||
* If we are modifying the loaded rundown we re-init it
|
||||
* This is likely over-kill but the simplest way to ensure state consistency
|
||||
*/
|
||||
if (isCurrentRundown(id)) {
|
||||
const rundown = dataProvider.getRundown(id);
|
||||
const customField = dataProvider.getCustomFields();
|
||||
// init rundown does its own refetch
|
||||
await initRundown(rundown, customField);
|
||||
} else {
|
||||
setImmediate(() => {
|
||||
sendRefetch(RefetchKey.ProjectRundowns);
|
||||
});
|
||||
if (rundown.title === title) {
|
||||
return getDataProvider().getProjectRundowns();
|
||||
}
|
||||
|
||||
return dataProvider.getProjectRundowns();
|
||||
rundown.title = title;
|
||||
|
||||
// a title has no bearing on the schedule, there is nothing to process and no runtime to notify
|
||||
const { rundownMetadata, revision } = await commit(false);
|
||||
|
||||
setImmediate(() => {
|
||||
notifyChanges(id, rundownMetadata, revision, { external: true });
|
||||
sendRefetch(RefetchKey.ProjectRundowns);
|
||||
});
|
||||
|
||||
return getDataProvider().getProjectRundowns();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user