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
correct-apricot•2y 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 ?correct-apricot•2y 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
extended-salmon•2y ago
made this via DeleteButton
![No description](https://cdn.answeroverflow.com/1054396843561341018/image.png)
correct-apricot•2y ago
it's seems okay. can you share
deleteOne
method from DataProvider
with me ?extended-salmon•2y ago
![No description](https://cdn.answeroverflow.com/1054401173752393728/image.png)
correct-apricot•2y ago
are you trying to delete different resource from table ?
extended-salmon•2y 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)
correct-apricot•2y ago
table data's resource is
requisite
too isn't it ?extended-salmon•2y ago
![No description](https://cdn.answeroverflow.com/1054403483241029692/image.png)
extended-salmon•2y ago
too
but he use hoc resource
extended-salmon•2y ago
![No description](https://cdn.answeroverflow.com/1054403701776851084/image.png)
correct-apricot•2y 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
extended-salmon•2y 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
correct-apricot•2y 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
extended-salmon•2y 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