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
narrow-beige
narrow-beige2y 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 ?
narrow-beige
narrow-beige2y 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
optimistic-gold
optimistic-gold2y ago
made this via DeleteButton
No description
narrow-beige
narrow-beige2y ago
it's seems okay. can you share deleteOne method from DataProvider with me ?
optimistic-gold
optimistic-gold2y ago
No description
narrow-beige
narrow-beige2y ago
are you trying to delete different resource from table ?
optimistic-gold
optimistic-gold2y 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)
narrow-beige
narrow-beige2y ago
table data's resource is requisite too isn't it ?
optimistic-gold
optimistic-gold2y ago
No description
optimistic-gold
optimistic-gold2y ago
too but he use hoc resource
optimistic-gold
optimistic-gold2y ago
No description
narrow-beige
narrow-beige2y 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"}
optimistic-gold
optimistic-gold2y 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
narrow-beige
narrow-beige2y 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);
}}
/>
optimistic-gold
optimistic-gold2y 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
narrow-beige
narrow-beige2y 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 🙏
optimistic-gold
optimistic-gold2y ago
No description
narrow-beige
narrow-beige2y 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
optimistic-gold
optimistic-gold2y ago
updating)
optimistic-gold
optimistic-gold2y ago
No description
optimistic-gold
optimistic-gold2y 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
optimistic-gold
optimistic-gold2y ago
so after update it works fine) thank you!
narrow-beige
narrow-beige2y ago
i'm glad to hear that 🙏