fix: custom fields not persisted (#1891)

This commit is contained in:
Alex Christoffer Rasmussen
2025-11-26 17:58:00 +01:00
committed by GitHub
parent c20ea88021
commit 48f2511764
@@ -316,10 +316,17 @@ export async function patchCurrentProject(data: Partial<DatabaseModel>) {
// we can pass some stuff straight to the data provider // we can pass some stuff straight to the data provider
await getDataProvider().mergeIntoData(rest); await getDataProvider().mergeIntoData(rest);
// ... but rundown and custom fields need to be checked // the rundown depends on custom fields
if (rundowns != null) { // so custom fields needs to be checked first
const customFields = parseCustomFields(data); if (customFields) {
const result = parseRundowns(data, customFields); const parsedCustomFields = parseCustomFields(data);
await getDataProvider().mergeIntoData({ customFields: parsedCustomFields });
}
// then we can checked the rundown
if (rundowns) {
const parsedCustomFields = await getDataProvider().getCustomFields();
const result = parseRundowns(data, parsedCustomFields);
/** /**
* The user may have multiple rundowns * The user may have multiple rundowns
@@ -330,7 +337,7 @@ export async function patchCurrentProject(data: Partial<DatabaseModel>) {
const rundownToLoad = const rundownToLoad =
last?.rundownId && last.rundownId in result ? result[last.rundownId] : getFirstRundown(result); last?.rundownId && last.rundownId in result ? result[last.rundownId] : getFirstRundown(result);
await initRundown(rundownToLoad, customFields, true); await initRundown(rundownToLoad, parsedCustomFields, true); //mergeIntoData is handled by the init function
} }
const updatedData = await getDataProvider().getData(); const updatedData = await getDataProvider().getData();