Fix reload behaviour; don't override global with empty local value

This commit is contained in:
2026-06-10 04:17:54 +02:00
parent 7491c0a1b4
commit d666dd90ee
16 changed files with 48 additions and 39 deletions

View File

@@ -474,7 +474,7 @@ function buildPreviewContext(draft: Record<string, unknown> | null, entry: Recor
addContextValue(context, key, "local", value);
}
for (const [key, value] of Object.entries(entryFields)) {
if (canOverrideField(overridePolicy, key)) {
if (canOverrideField(overridePolicy, key) && hasPreviewOverrideValue(value)) {
addContextValue(context, key, "local", value);
}
}
@@ -505,6 +505,12 @@ function addContextValue(context: Record<string, string>, key: string, namespace
context[`${namespace}::${key}`] = text;
}
function hasPreviewOverrideValue(value: unknown): boolean {
if (value === undefined || value === null) return false;
if (typeof value === "string") return value.trim() !== "";
return true;
}
function renderPreviewText(text: string, context: Record<string, string>, ignoreEmptyFields: boolean): string {
if (!text) return "";
return text