Field config: Respect config paths when rendering default value of field config property (#27652)

This commit is contained in:
Dominik Prokop 2020-09-18 15:46:16 +02:00 committed by GitHub
parent 564d7ecea7
commit e5b16952c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,5 @@
import React, { ReactNode, useCallback } from 'react';
import cloneDeep from 'lodash/cloneDeep';
import { get as lodashGet, cloneDeep } from 'lodash';
import {
DataFrame,
DocsId,
@ -146,9 +146,9 @@ export const DefaultFieldConfigEditor: React.FC<Props> = ({ data, onChange, conf
const defaults = config.defaults;
const value = item.isCustom
? defaults.custom
? defaults.custom[item.path]
? lodashGet(defaults.custom, item.path)
: undefined
: (defaults as any)[item.path];
: lodashGet(defaults, item.path);
let label: ReactNode | undefined = (
<Label description={item.description} category={item.category?.slice(1)}>