router icon indicating copy to clipboard operation
router copied to clipboard

Relative navigation is broken

Open NickSoftDev opened this issue 1 year ago • 0 comments

Describe the bug

The documentation featuring the relative navigation is not in the examples or in other code using navigate with relative routing. According to the documentation: Everything is Relative Believe it or not, every navigation within an app is relative, even if you aren't using explicit relative path syntax (../../somewhere).

the statement above is clearly not working. Neither is any routes disaplyed exept for "../" in the typescript hints.

const Component1 = () => { const navigate = useNavigate({from:"/tests/examples/$exampleId"}); navigate({to: "../../"}); }

or

const Component2 = () => { const navigate = useNavigate({from:"/tests/foo/$fooId"}); navigate({to: "../examples/$exampleId", params: {exampleId: "23"}}); }

Example: 1 eaxmple 2

Example: 2 example 1

Your Example Website or App

https://tanstack.com/router/v1/docs/examples/react/kitchen-sink-react-query-file-based

Steps to Reproduce the Bug or Issue

Go to https://tanstack.com/router/v1/docs/examples/react/kitchen-sink-react-query-file-based Navigate to the file dashboard.invoices.$invoiceId.tsx try to replace with navigate and relative routing navigate({to: "../other/route"});

Expected behavior

The relative paths should compile and give support for relatives routes in typescript highlights.

Screenshots or Videos

No response

Platform

  • OS: [e.g. macOS, Windows, Linux]
  • Browser: [e.g. Chrome, Safari, Firefox]
  • Version: [e.g. 91.1]

Additional context

No response

NickSoftDev avatar Jan 23 '24 12:01 NickSoftDev