You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some circumstances <Routes> or useRoutes is not matching deeper routes when the params are URI encoded.
This seems to be caused by a bug in the new getPathnameStart function. It's using the length of the params to work out where to trim the pathname. But params has already been URI decoded, whereas the pathname has not, so the .length is not reliable.
What version of React Router are you using?
6.0.0-beta.5
Steps to Reproduce
In some circumstances
<Routes>
oruseRoutes
is not matching deeper routes when the params are URI encoded.This seems to be caused by a bug in the new getPathnameStart function. It's using the length of the
params
to work out where to trim thepathname
. Butparams
has already been URI decoded, whereas thepathname
has not, so the.length
is not reliable.Repro at https://codesandbox.io/s/happy-villani-nee76?file=/src/App.js. Click on the "Item with id of ::" link and it doesn't render. If you downgrade to 6.0.0-beta.4 it works as expected.
Expected Behavior
In the codesandbox, /items/abc/%3A%3A should render the
<SingleItem />
component.Actual Behavior
It matches /items/abc/%3A and /items/abc/hi, but not /items/abc/%3A%3A.
The text was updated successfully, but these errors were encountered: