Automatic URL unescaping on first load causes match failure
Describe the bug
On initial page load, tanstack router will unescape the url, which causes problems when reserved characters (such as #) were escaped and are no longer.
For example /foo%23/test will match /$id/test, but on first load it becomes /foo#/test which matches /$id but not /$id/test.
Your Example Website or App
https://stackblitz.com/edit/github-jaqhfz?file=src%2Fmain.tsx
Steps to Reproduce the Bug or Issue
This example won't work in the embedded browser on stackblitz so be sure to use the popout button near the top right.
- Go to:
/ - Click on the link
te#st/testwhich will take you to/te%23st/test(displaying "Hello /$id/test") - Refresh your browser tab
- Notice that your URL is now
/te#st/testand the page displays ("Hello /$id")
Expected behavior
I would expect that refreshing would keep us at /te%23st/test and display "Hello /$id/test" because we would still be matching the /$id/test route.
Screenshots or Videos
No response
Platform
- OS: macOS
- Browser: Chrome
- Version: 127.0.6533.120
Additional context
We found this bug by updating from 1.17.4 to 1.48.3. Obviously that's a huge bisect, but clearly this changed somewhere in there.