mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-12 19:03:47 +00:00
feat: notify clients to refetch custom fields
This commit is contained in:
committed by
Carlos Valente
parent
473f50b493
commit
9473880d2c
@@ -152,6 +152,9 @@ export const connectSocket = () => {
|
||||
case RefetchKey.All:
|
||||
invalidateAllCaches();
|
||||
break;
|
||||
case RefetchKey.CustomFields:
|
||||
ontimeQueryClient.invalidateQueries({ queryKey: CUSTOM_FIELDS });
|
||||
break;
|
||||
case RefetchKey.Rundown:
|
||||
if (revision === (ontimeQueryClient.getQueryData(RUNDOWN) as Rundown).revision) break;
|
||||
ontimeQueryClient.invalidateQueries({ queryKey: RUNDOWN });
|
||||
|
||||
@@ -429,7 +429,9 @@ export async function createCustomField(customField: CustomField): Promise<Custo
|
||||
// Adding a custom field has no immediate implications on the rundown
|
||||
const { customFields: resultCustomFields } = commit(false);
|
||||
|
||||
// TODO: notify clients to refetch the custom fields
|
||||
setImmediate(() => {
|
||||
sendRefetch(RefetchKey.CustomFields);
|
||||
});
|
||||
|
||||
return resultCustomFields;
|
||||
}
|
||||
@@ -470,7 +472,6 @@ export async function editCustomField(key: CustomFieldKey, newField: Partial<Cus
|
||||
|
||||
// schedule the side effects
|
||||
setImmediate(() => {
|
||||
// TODO: notify clients to refetch the custom fields
|
||||
notifyChanges(rundownMetadata, revision, { timer: true, external: true });
|
||||
});
|
||||
|
||||
@@ -499,7 +500,6 @@ export async function deleteCustomField(key: CustomFieldKey): Promise<CustomFiel
|
||||
|
||||
// schedule the side effects
|
||||
setImmediate(() => {
|
||||
// TODO: notify clients to refetch the custom fields
|
||||
notifyChanges(rundownMetadata, revision, { timer: true, external: true });
|
||||
});
|
||||
|
||||
@@ -572,5 +572,7 @@ export async function initRundown(rundown: Readonly<Rundown>, customFields: Read
|
||||
updateRuntimeOnChange(rundownMetadata);
|
||||
|
||||
// notify timer of change
|
||||
notifyChanges(rundownMetadata, revision, { timer: true, external: true, reload: true });
|
||||
setImmediate(() => {
|
||||
notifyChanges(rundownMetadata, revision, { timer: true, external: true, reload: true });
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
export enum RefetchKey {
|
||||
All = 'all',
|
||||
CustomFields = 'custom-fields',
|
||||
Report = 'report',
|
||||
Rundown = 'rundown',
|
||||
ViewSettings = 'view-settings',
|
||||
|
||||
Reference in New Issue
Block a user