OverrideEditor: Use field config default value when adding a new override (#24347)

This commit is contained in:
Torkel Ödegaard 2020-05-06 17:43:34 +02:00 committed by GitHub
parent 66b7398fb6
commit 75ce947267
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -82,14 +82,18 @@ export const OverrideEditor: React.FC<OverrideEditorProps> = ({
const onDynamicConfigValueAdd = useCallback(
(id: string) => {
const registryItem = registry.get(id);
const propertyConfig: DynamicConfigValue = {
id,
value: registryItem.defaultValue,
};
if (override.properties) {
override.properties.push(propertyConfig);
} else {
override.properties = [propertyConfig];
}
onChange(override);
},
[override, onChange]