Skip to content

Commit

Permalink
Merge branch 'main' into warren/cleanup-app-deps
Browse files Browse the repository at this point in the history
  • Loading branch information
wrn14897 committed Mar 3, 2024
2 parents 3d16404 + b21eada commit 741e2cd
Showing 1 changed file with 19 additions and 21 deletions.
40 changes: 19 additions & 21 deletions packages/app/src/ChartUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ import { useMemo, useRef, useState } from 'react';
import { add } from 'date-fns';
import Select from 'react-select';
import AsyncSelect from 'react-select/async';
import { Divider, Group, Paper, SegmentedControl } from '@mantine/core';
import {
Divider,
Group,
Paper,
SegmentedControl,
Select as MSelect,
} from '@mantine/core';

import { NumberFormatInput } from './components/NumberFormat';
import api from './api';
Expand Down Expand Up @@ -482,34 +488,26 @@ export function MetricNameSelect({
}, [metricNamesData]);

return (
<AsyncSelect
isLoading={isLoading}
isDisabled={isError}
<MSelect
disabled={isLoading || isError}
variant="filled"
placeholder={
isLoading
? 'Loading...'
: isError
? 'Unable to load metrics'
: 'Select a metric...'
}
loadOptions={input => {
return Promise.resolve(
options.filter(v =>
input.length > 0
? v.value.toLowerCase().includes(input.toLowerCase())
: true,
),
);
data={options}
limit={100}
comboboxProps={{
position: 'bottom-start',
width: 'auto',
}}
defaultOptions={options}
value={
value != null
? options.find(v => v.value === value)
: { value: undefined, label: 'None' }
}
onChange={opt => setValue(opt?.value)}
className="ds-select"
classNamePrefix="ds-react-select"
value={value ?? undefined}
searchable
clearable
onChange={value => setValue(value ?? undefined)}
/>
);
}
Expand Down

0 comments on commit 741e2cd

Please sign in to comment.