Closed goenning closed 1 year ago
I've got a commit that fixes this in a custom build of the router.
This stackblitz link is using our "patched" router to demonstrate the solution. Does that work for you?
I just haven't submitted this as a PR here as I'm not sure if it would be breaking for others.
Yeah, your package works for me. But there is a breaking change though, on the official package if I use encodeURIComponent
, I don't need to decode on the useParams.
It seems like with your package I need to decode it when reading it.
Yeah this fix is basically reverting more of the change introduced on May 18th in this commit (of which some has already been reverted).
Aside from solving your issue, my feeling is the router shouldn't be decoding things it didn't encode in the first place. Like if the application code is encoding something it in not unreasonable to expect to have to decode it when used.
@ryansolid Let me know if you'd like me to submit the commit linked above as a PR (or just grab it if you want to).
I agree. We shouldn't be decoding things we didn't encode in the first place.
Looking back at the original issue(https://github.com/solidjs/solid-router/issues/112), I think expecting spaces in the URL to work is strange anyway. I haven't used other modern solutions but like I'd expect if I chose to put a space in there I'd need to do the %20
myself.
Pull request submitted. https://github.com/solidjs/solid-router/pull/222
Describe the bug
I have a route path like
/:name/view
and then the name might actually contain a forward slash, so i encode it withencodeURIComponent
, but solid-router doesn't route it correct, it goes straight to 404.Your Example Website or App
https://stackblitz.com/edit/solidjs-template-15p2rm
Steps to Reproduce the Bug or Issue
/hello-world/view
and it'll work/hello%2Fworld/view
and you'll see a 404 pageExpected behavior
I expect the url
/hello%2Fworld/view
to match the/:name/view
route path.Screenshots or Videos
No response
Platform
Additional context
No response