feat: disable select when loading (#2475)
parent
95a793dd5a
commit
307b098f83
|
@ -151,11 +151,28 @@ const AvailabilitySelect = ({
|
||||||
onBlur: Noop;
|
onBlur: Noop;
|
||||||
onChange: (value: AvailabilityOption | null) => void;
|
onChange: (value: AvailabilityOption | null) => void;
|
||||||
}) => {
|
}) => {
|
||||||
|
const { t } = useLocale();
|
||||||
const query = trpc.useQuery(["viewer.availability.list"]);
|
const query = trpc.useQuery(["viewer.availability.list"]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<QueryCell
|
<QueryCell
|
||||||
query={query}
|
query={query}
|
||||||
|
loading={() => {
|
||||||
|
return (
|
||||||
|
<Select
|
||||||
|
isDisabled
|
||||||
|
options={[]}
|
||||||
|
isSearchable={false}
|
||||||
|
onChange={props.onChange}
|
||||||
|
classNamePrefix="react-select"
|
||||||
|
className={classNames(
|
||||||
|
"react-select-container focus:border-primary-500 focus:ring-primary-500 block w-full min-w-0 flex-1 rounded-sm border border-gray-300 sm:text-sm",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
placeholder={t("loading")}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}}
|
||||||
success={({ data }) => {
|
success={({ data }) => {
|
||||||
const options = data.schedules.map((schedule) => ({
|
const options = data.schedules.map((schedule) => ({
|
||||||
value: schedule.id,
|
value: schedule.id,
|
||||||
|
|
Loading…
Reference in New Issue