feat(ui) - cards - fixed an issue with card subtype selection
This commit is contained in:
parent
2d8e23933c
commit
386df089f3
1 changed files with 4 additions and 2 deletions
|
|
@ -14,7 +14,7 @@ function MetricSubtypeDropdown(props: Props) {
|
|||
const { metricStore } = useStore();
|
||||
const metric: any = metricStore.instance;
|
||||
|
||||
const options = React.useMemo(() => {
|
||||
const options: any = React.useMemo(() => {
|
||||
const type = TYPES.find((i: MetricType) => i.slug === metric.metricType);
|
||||
if (type && type.subTypes) {
|
||||
const options = type.subTypes.map((i: MetricType) => ({
|
||||
|
|
@ -30,7 +30,9 @@ function MetricSubtypeDropdown(props: Props) {
|
|||
|
||||
React.useEffect(() => {
|
||||
// @ts-ignore
|
||||
setTimeout(() => props.onSelect({ name: 'metricOf', value: { value: options[0].value }}), 0)
|
||||
if (options && !options.map(i => i.value).includes(metric.metricOf)) {
|
||||
setTimeout(() => props.onSelect({ name: 'metricOf', value: { value: options[0].value }}), 0)
|
||||
}
|
||||
}, [metric.metricType])
|
||||
|
||||
return options ? (
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue