not making api call for edit basic view antd d
<Edit
title={title}
dataProviderName='unifiedDataProvider'
resource='post'
recordItemId='1'
footerButtons={() => (
<>
<Button>Cancel</Button>
<SaveButton
{...saveButtonProps}
disabled={
joinedColumnList === undefined || joinedColumnList?.length === 0
}
>
Save
</SaveButton>
</>
)}
>
<JoinColumnForm
formLoading={formLoading}
onFinishHandler={onFinishHandler}
formProps={formProps}
showSearch={true}
setOtherColumns={setOtherColumns}
otherColumns={otherColumns}
column1={column1}
column2={column2}
form={form}
/>
</Edit>
not calling the get one api for the above edit view from antd
5 Replies
Hi @jash.s. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
The
<Edit>
component in Refine reads the id
information from the route by default. If it cannot read from the URL, which happens when it's used on a custom page, modal, or drawer, recordItemId
is used. The recordItemId
is necessary for the <RefreshButton>
to work properly and fetch the data for the record to be edited.
In your case, you have provided recordItemId='1'
which should ideally fetch the data for the record with id 1. If it's not making the API call, it could be due to some other issue.
You can also customize the save button using the saveButtonProps
property. If you want to modify the request sent when the "Save" button is clicked, you can use the useForm
hook and modify the onFinish
handler. Here's an example from the Refine documentation (https://refine.dev/docs/api-reference/antd/hooks/form/useForm/#how-can-i-change-the-form-data-before-submitting-it-to-the-api):
In this example, the onFinishHandler
modifies the form data before it's submitted to the API.
If you're still facing issues, it would be helpful to check the network tab in your browser's developer tools to see if any requests are being made when the Edit view is loaded. If there are any errors, they should show up there.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1129363768661516329> kapa.ai is still learning and improving, please let us know how it did by reacting below
metropolitan-bronze•8mo ago
get one api is not called @kapa.ai
Let me check the knowledge base for you. One moment! :books:
----------------------
The
getOne
API call is typically triggered when you use the useOne
hook or when you navigate to an <Edit>
or <Show>
page in Refine. The getOne
method in your data provider is responsible for fetching a single record based on its ID.
In your case, you're using the <Edit>
component and providing a recordItemId
prop. This should trigger a getOne
API call to fetch the data for the record with the ID you've specified.
If the getOne
API call is not being made, it could be due to a few reasons:
1. There might be an issue with your data provider configuration. Ensure that your getOne
method in your data provider is correctly implemented.
2. The recordItemId
you're providing might not be correct or might not exist in your data source.
3. There might be an issue with the way your routes are set up. If you're using <Edit>
on a custom page, ensure that the recordItemId
prop is correctly passed.
If you're still facing issues, it would be helpful to check the network tab in your browser's developer tools to see if any requests are being made when the Edit view is loaded. If there are any errors, they should show up there.
For more information on how to use the getOne
method and the useOne
hook, you can refer to the Refine documentation (https://refine.dev/docs/guides-concepts/data-fetching#getone-).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1129363768661516329> kapa.ai is still learning and improving, please let us know how it did by reacting below