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
solid-orange•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 ?solid-orange•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
sunny-green•2y ago
made this via DeleteButton
solid-orange•2y ago
it's seems okay. can you share
deleteOne
method from DataProvider
with me ?sunny-green•2y ago
solid-orange•2y ago
are you trying to delete different resource from table ?
sunny-green•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)
solid-orange•2y ago
table data's resource is
requisite
too isn't it ?sunny-green•2y ago
sunny-green•2y ago
too
but he use hoc resource
sunny-green•2y ago
solid-orange•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
sunny-green•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
solid-orange•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
sunny-green•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
solid-orange•2y ago
I'm glad to hear that.
on Buttons,
resource
is a not a correct prop. it should be resourceNameOrRouteName
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 🙏sunny-green•2y ago
solid-orange•2y 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
sunny-green•2y ago
updating)
sunny-green•2y ago
sunny-green•2y ago
another problem)
i installed refine cli as package
but where are script commands?
Make sure you follow these documents
https://refine.dev/docs/packages/documentation/cli/
solid-orange•2y ago
you can find installation and usage here. https://refine.dev/docs/packages/documentation/cli/#how-to-add-to-an-existing-project
update commands here : https://refine.dev/docs/packages/documentation/cli/#update
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-packagessunny-green•2y ago
so after update it works fine)
thank you!
solid-orange•2y ago
i'm glad to hear that 🙏