[BUG] redirect in useForm refineCoreProps doens't work
mimccio opened this issue · 4 comments
Describe the bug
Adding redirect: 'show'
or redirect: 'list'
in refineCoreProps does not redirect as shown in [the doc](redirect: 'show)
Steps To Reproduce
const {
saveButtonProps,
refineCore: { queryResult, formLoading },
register,
control,
formState: { errors },
} = useForm<Person>({
refineCoreProps: {
resource: 'person',
dataProviderName: 'provider-name',
id,
action: 'edit',
redirect: 'show', // Does not work !
},
})
Expected behavior
Adding redirect: 'show'
should redirect after editing or creating.
Packages
"@refinedev/cli": "^2.16.36",
"@refinedev/core": "^4.53.0",
"@refinedev/devtools": "^1.2.6",
"@refinedev/inferencer": "^4.6.6",
"@refinedev/kbar": "^1.3.12",
"@refinedev/mui": "^5.19.0",
"@refinedev/react-hook-form": "^4.8.20",
"@refinedev/react-router-v6": "^4.5.11",
"@refinedev/simple-rest": "^5.0.8",
Additional Context
As a workaround we can use onMutationSuccess
to achive this behaviour
Hey @mimccio, sorry for the issue. I've tested using the code you've provided but redirect has worked as expected for me. Can you make sure you have show
or edit
routes are defined for your resource in <Refine />
component?
Hey @mimccio can you check my comment above? If this is not the case, please provide a minimal repro 🙏
@mimccio I'm closing the issue because we couldn't reproduce the problem and didn't find any issues in our tests. If you have any problems, please don't hesitate to reopen it with a reproducible example. Thank you.
Thanks for your help I
The issue was that the name of the provider.
Sorry for opening this ticket, my bad.