other-emerald
other-emerald17mo ago

Property 'overtime' does not exist on type 'UseSelectReturnType'

Hi! I'm using the documentation and it indicates that antd's useSelect has overtime (https://refine.dev/docs/api-reference/antd/hooks/field/useSelect/#overtimeoptions) When I try using it, though, it says Property 'overtime' does not exist on type 'UseSelectReturnType<{ trailerNo: any; } & { trailerNo: any; }>'. How can I check if useSelect is in the middle of loading?
useSelect | refine
useSelect hook allows you to manage Ant Design's `` component when the records in a resource needs to be used as select options.
9 Replies
kapa.ai
kapa.ai17mo ago
Hi @avangeous. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- The useSelect hook from refine's Ant Design integration does not have an overtime property according to the provided extracts. However, it does return a selectProps object which includes a loading property. This loading property indicates whether the default value query is currently fetching data. Here's a snippet from the source code of useSelect inside the @refinedev/antd package:
const { queryResult, defaultValueQueryResult, onSearch, options } =
useSelectCore(props);

return {
selectProps: {
options,
onSearch,
loading: defaultValueQueryResult.isFetching,
showSearch: true,
filterOption: false,
},
queryResult,
defaultValueQueryResult,
};
const { queryResult, defaultValueQueryResult, onSearch, options } =
useSelectCore(props);

return {
selectProps: {
options,
onSearch,
loading: defaultValueQueryResult.isFetching,
showSearch: true,
filterOption: false,
},
queryResult,
defaultValueQueryResult,
};
In this code, defaultValueQueryResult.isFetching is used to set the loading property of selectProps. You can use this loading property to check if useSelect is in the middle of loading. Please refer to the documentation (https://refine.dev/docs/api-reference/antd/hooks/field/useSelect) for more details. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai17mo ago
<@1122927158348763206> kapa.ai is still learning and improving, please let us know how it did by reacting below
other-emerald
other-emeraldOP17mo ago
@kapa.ai Property 'loading' does not exist on type 'UseSelectReturnType
kapa.ai
kapa.ai17mo ago
Let me check the knowledge base for you. One moment! :books: ---------------------- The loading property is not directly on the UseSelectReturnType but rather it's nested within the selectProps object that useSelect returns. Here's how you can access it:
const { selectProps } = useSelect(...);
const isLoading = selectProps.loading;
const { selectProps } = useSelect(...);
const isLoading = selectProps.loading;
In this code, useSelect is called and its return value is destructured to get selectProps. Then, selectProps.loading is accessed to get the loading state. Please refer to the documentation (https://refine.dev/docs/api-reference/antd/hooks/field/useSelect) for more details. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai17mo ago
<@1122927158348763206> kapa.ai is still learning and improving, please let us know how it did by reacting below
other-emerald
other-emeraldOP17mo ago
@kapa.ai Does useModalForm have anything similar?
kapa.ai
kapa.ai17mo ago
Let me check the knowledge base for you. One moment! :books: ---------------------- Yes, the useModalForm hook from refine's Ant Design integration does return a similar property. It returns a formLoading property which indicates the loading status of the form. Here's a snippet from the API reference for useModalForm: | Key | Description | Type | | --- | --- | --- | | formLoading | Loading status of form | boolean | You can use this formLoading property to check if useModalForm is in the middle of loading. Please refer to the documentation (https://refine.dev/docs/api-reference/antd/hooks/form/useModalForm) for more details. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai17mo ago
<@1122927158348763206> kapa.ai is still learning and improving, please let us know how it did by reacting below
variable-lime
variable-lime17mo ago
hi @avangeous , what is your refine version ? this feature released on @refinedev/core@4.24.0

Did you find this page helpful?