Fix reload behaviour; don't override global with empty local value
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user