NewPanelEdit: Fixed error with custom override properties (#23055)

This commit is contained in:
Torkel Ödegaard 2020-03-25 14:04:41 +01:00 committed by GitHub
parent 0ed78068a2
commit 0870ccea7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 2 deletions

View File

@ -204,8 +204,8 @@ function setDynamicConfigValue(config: FieldConfig, value: DynamicConfigValue, c
const remove = val === undefined || val === null;
if (remove) {
if (value.custom) {
delete (config?.custom as any)[value.prop];
if (value.custom && config.custom) {
delete config.custom[value.prop];
} else {
delete (config as any)[value.prop];
}

View File

@ -105,6 +105,33 @@ export const basicSelectPlainValue = () => {
);
};
/**
* Uses plain values instead of SelectableValue<T>
*/
export const SelectWithOptionDescriptions = () => {
// TODO this is not working with new Select
const [value, setValue] = useState<number>();
const options = [
{ label: 'hello', value: 1, description: 'this is a description' },
{ label: 'hello 2', value: 2, description: 'second description' },
];
return (
<>
<Select
options={options}
value={value}
onChange={v => {
setValue(v.value);
}}
size="md"
{...getDynamicProps()}
/>
</>
);
};
/**
* Uses plain values instead of SelectableValue<T>
*/