/* eslint-disable react-hooks/exhaustive-deps */ import React, { useMemo, isValidElement } from 'react' import { Select, SelectProps as AntdSelectProps, Input } from 'antd' import { run } from '@fexd/tools' import { FormattedMessage } from '@fexd/pro-utils' import useRemoteOptions from './useRemoteOptions' import useLocales from '../../locales' export default function RemoteSelect(props: AntdSelectProps) { const { loading, options: rawOptions } = useRemoteOptions(props?.options) const { t } = useLocales(({ t }) => [t]) const options = useMemo( () => rawOptions ?.map((option: any) => ({ ...option, label: run(option?.getLabel, undefined) ?? option?.label, })) .filter((option) => !option?.readonly), [rawOptions, t], ) return ( ) }