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
correct-apricot2y 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
correct-apricot2y 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
extended-salmon2y ago
made this via DeleteButton
No description
correct-apricot
correct-apricot2y ago
it's seems okay. can you share deleteOne method from DataProvider with me ?
extended-salmon
extended-salmon2y ago
No description
correct-apricot
correct-apricot2y ago
are you trying to delete different resource from table ?
extended-salmon
extended-salmon2y 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
correct-apricot2y ago
table data's resource is requisite too isn't it ?
extended-salmon
extended-salmon2y ago
No description
extended-salmon
extended-salmon2y ago
too but he use hoc resource
extended-salmon
extended-salmon2y ago
No description
correct-apricot
correct-apricot2y 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"}
extended-salmon
extended-salmon2y 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
correct-apricot2y 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);
}}
/>
extended-salmon
extended-salmon2y 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