fair-rose
fair-rose2y ago

can't emit refetch list data after deleting one element from this list

can't emit refetch list data after deleting one element from this list
26 Replies
fascinating-indigo
fascinating-indigo2y ago
https://refine.dev/docs/api-reference/core/hooks/invalidate/useInvalidate/ you can manually invalidate after delete operation. https://refine.dev/docs/api-reference/core/hooks/data/useDelete/ but, refine should handle this automaticly. are you using useDelete() hook ? what is your implementation looks like ?
fascinating-indigo
fascinating-indigo2y ago
i couldn't reproduce the issue. it's working as expected. if you give more information about your implementation. i will try to debug 🙏 https://stackblitz.com/edit/refinedev-refine-3kkxqx?file=src/pages/posts/list.tsx
Refine Tutorial Antd Example (forked) - StackBlitz
Run official live example code for Refine Tutorial Antd, created by Refinedev on StackBlitz
fair-rose
fair-rose2y ago
made this via DeleteButton
No description
fascinating-indigo
fascinating-indigo2y ago
it's seems okay. can you share deleteOne method from DataProvider with me ?
fair-rose
fair-rose2y ago
No description
fascinating-indigo
fascinating-indigo2y ago
are you trying to delete different resource from table ?
fair-rose
fair-rose2y ago
as you can see, in delete button i set resource = 'requisite' but on deleteOne method he use another resource i don't know why)
fascinating-indigo
fascinating-indigo2y ago
table data's resource is requisite too isn't it ?
fair-rose
fair-rose2y ago
No description
fair-rose
fair-rose2y ago
too but he use hoc resource
fair-rose
fair-rose2y ago
No description
fascinating-indigo
fascinating-indigo2y ago
thank you for clear explanation ! 🙏 can you try this please ? it's maybe will not solve but worth a shot. i will investigate more
<DeleteButton
resourceNameOrRouteName={"requisite"}
<DeleteButton
resourceNameOrRouteName={"requisite"}
fair-rose
fair-rose2y ago
i've got nested table in show page of previous table) no( didn't work i'll try to handle it through useDelete hook
fascinating-indigo
fascinating-indigo2y ago
sorry for your trouble. i suggest you should manually invalidate resource. useDelete hook have invalidates prop. if useDelete hook not work, u can try this solution. https://refine.dev/docs/api-reference/core/hooks/invalidate/useInvalidate/ you can invalidate on onSuccess callback
<DeleteButton
size="small"
recordItemId={record.id}
onSuccess={(value) => {
console.log(value);
}}
/>
<DeleteButton
size="small"
recordItemId={record.id}
onSuccess={(value) => {
console.log(value);
}}
/>
fair-rose
fair-rose2y ago
thats strange but in case with useDelete hook it is works fine) via mutate option i think that the reason why it didn't work without refetch, cause i can't pass resource props in DeleteButton let me show
fascinating-indigo
fascinating-indigo2y ago
I'm glad to hear that. on Buttons, resource is a not a correct prop. it should be resourceNameOrRouteName
<DeleteButton
resourceNameOrRouteName={"requisite"}
<DeleteButton
resourceNameOrRouteName={"requisite"}
By the way, I talk with the core team. It can be bug <DeleteButton> from previous versions. Which versions are u using ? U can easliy check versions with refine cli https://refine.dev/docs/packages/documentation/cli/#whoami And easily update with check-updates command. After update, if it's solved please let me know your previous version 🙏
fair-rose
fair-rose2y ago
No description
fascinating-indigo
fascinating-indigo2y ago
antd, core and react-router quite old. If you want, it can be easily update with this command. https://refine.dev/docs/packages/documentation/cli/#update I hope this will solve <DeleteButton> invalidate issue. if it's not, ofc you can go with useDelete hook
fair-rose
fair-rose2y ago
updating)
fair-rose
fair-rose2y ago
No description
fair-rose
fair-rose2y ago
another problem) i installed refine cli as package but where are script commands?
Omer
Omer2y ago
Make sure you follow these documents https://refine.dev/docs/packages/documentation/cli/
Omer
Omer2y ago
We just released our Ant Design v5 support. If you don't want to migrate your project to v5, make sure you are using the @pankod/refine-antd@3 version 👀 if you want to upgrade you can follow this documentation, https://refine.dev/docs/api-reference/antd/migration-guide/v4-to-v5/#updating-the-packages
fair-rose
fair-rose2y ago
so after update it works fine) thank you!
fascinating-indigo
fascinating-indigo2y ago
i'm glad to hear that 🙏