Show the template value while a link is staged

Part of #200

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Opus 5.5 committed 2026-11-02 11:54:37 +00:00
1 parent cd04995b65
commit 943619a657
2 files changed
+21 -4

No files matched your search

@@ -74,6 +74,7 @@ export type ConfigInheritance = {
canInherit: (config: lib.Config<any>, field: string) => boolean;
isInherited: (config: lib.Config<any>, field: string, prop?: string) => boolean;
inherit: (field: string, prop?: string) => Promise<void>;
templateValue: (field: string, prop?: string) => unknown;
notice?: (config: lib.Config<any>) => React.ReactNode;
};
@@ -331,12 +332,18 @@ function computeTreeData(
if (!linking.has(key)) {
return button(
"Not linked to the template. Click to link it again when applied.", <DisconnectOutlined />, "Link",
() => { setLinking(new Map([...linking, [key, [fieldName, prop]]])); revert(); },
() => {
setLinking(new Map([...linking, [key, [fieldName, prop]]]));
revert();
// Show the value the field takes after apply
const value = inheritance.templateValue(fieldName, prop);
form.setFieldValue(key, prop === undefined ? value : JSON.stringify(value));
},
);
}
return button(
"Linked to the template when applied. Click to keep this value instead.", <LinkOutlined />, "Unlink",
() => setLinking(new Map([...linking].filter(([k]) => k !== key))),
() => { setLinking(new Map([...linking].filter(([k]) => k !== key))); revert(); },
);
}
function isReadonly(canWrite: boolean, key: string, fieldName: string, prop?: string) {