-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
useGetToPath always returns undefined. Documentation is also wrong.
https://refine.dev/docs/routing/hooks/use-get-to-path/#usage
At docs >
getToPath({
resource: This doesn't accept string like the docs says so, it should be an object like {name: "blog_posts"}
Steps To Reproduce
- npm create refine-app@latest refine-test
- ✔ What would you like to name your project?: · refine-test
✔ Choose your backend service to connect: · data-provider-custom-json-rest (REST)
✔ Do you want to use a UI Framework?: · antd
✔ Do you want to add example pages?: · yes
✔ Do you need any Authentication logic?: · none - open src/pages/categories/list.tsx
- add a button before Table comp.
- define hooks.
const getToPath = useGetToPath()
const go = useGo()- define the handler to be called upon clicking the button
const clickHandler = () => {
const path = getToPath({
resource: {
name: "blog_posts"
},
action: "edit",
meta: {
id: "1"
}
})
console.log(path)
go({
to: path
})
}path is always undefined, there is no way I could get a meaningful value.
Expected behavior
getToPath should return a string to be passed to go({to: }) key.
Packages
System:
- OS: macOS 15.7.2
- CPU: (8) arm64 Apple M2
Binaries:
- Node: 22.12.0 - /Users/bugraotken/.nvm/versions/node/v22.12.0/bin/node
- Yarn: Not Found
- npm: 10.9.0 - /Users/bugraotken/.nvm/versions/node/v22.12.0/bin/npm
Browsers:
- Chrome: 143.0.7499.42
- Firefox: 145.0.2
- Safari: 26.1
Refine Packages:
- @refinedev/antd: 6.0.3
- @refinedev/cli: 2.16.50
- @refinedev/core: 5.0.6
- @refinedev/devtools: 2.0.3
- @refinedev/kbar: 2.0.1
- @refinedev/react-router: 2.0.3
- @refinedev/simple-rest: 6.0.1
Additional Context
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working