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
While following the migration guide in https://reactrouter.com/upgrading/v6 and after switching from v6.x to v7.x a non-documented breaking change in useParams() seems to be reproducible in unit tests. The current react-router useParams() unit tests do not cover the usage of RouteProvider explicitly and also use the deprecated "react-test-renderer" package. I would expect to have this behaviour mentioned in the migration guide (if not a bug) and some up-to-date tests to show the required changes between RouteProvider and createBrowserRouter().
Thanks a lot in advance!
Actual Behavior
When executing the test above with "[email protected]", the test using the route provider fails as useParams() does not return any parameters:
I'm using React Router as a...
library
Reproduction
Based on this useParams() test:
react-router/packages/react-router/__tests__/useParams-test.tsx
Line 50 in 595bed3
System Info
Used Package Manager
npm
Expected Behavior
Hi React Router Team,
While following the migration guide in https://reactrouter.com/upgrading/v6 and after switching from v6.x to v7.x a non-documented breaking change in
useParams()
seems to be reproducible in unit tests. The current react-routeruseParams()
unit tests do not cover the usage of RouteProvider explicitly and also use the deprecated "react-test-renderer" package. I would expect to have this behaviour mentioned in the migration guide (if not a bug) and some up-to-date tests to show the required changes betweenRouteProvider
andcreateBrowserRouter()
.Thanks a lot in advance!
Actual Behavior
When executing the test above with "[email protected]", the test using the route provider fails as
![Image](https://private-user-images.githubusercontent.com/794497/409168039-a04a6ea9-281f-43d7-81b0-2e0171413252.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNjgxNjUsIm5iZiI6MTczOTM2Nzg2NSwicGF0aCI6Ii83OTQ0OTcvNDA5MTY4MDM5LWEwNGE2ZWE5LTI4MWYtNDNkNy04MWIwLTJlMDE3MTQxMzI1Mi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS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Q11znvk0hfjapEg)
useParams()
does not return any parameters:When executing the test above with "[email protected]" and "[email protected]", both tests pass:
![Image](https://private-user-images.githubusercontent.com/794497/409168905-f847ee16-6ef4-42e3-9191-9fba27c22898.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNjgxNjUsIm5iZiI6MTczOTM2Nzg2NSwicGF0aCI6Ii83OTQ0OTcvNDA5MTY4OTA1LWY4NDdlZTE2LTZlZjQtNDJlMy05MTkxLTlmYmEyN2MyMjg5OC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMlQxMzQ0MjVaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1iMzU3ZGNkNWVjNzRkMzMwYzVkM2ZlZjU0OGU1Mjc3ZDczNzk3OWE5MmM1MjIwNWQ2ZTZiODhjYWQ2M2I4OTlkJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.QbsQKy0ZCGZlXkp3SU6TEcaJo7wU_w7MMv24V0MgURg)
Using all future flags does not fix the failing test either:
The text was updated successfully, but these errors were encountered: