next-routes icon indicating copy to clipboard operation
next-routes copied to clipboard

Router.pushRoute is case sensitive when using dynamic routes

Open juansalvatore opened this issue 5 years ago • 0 comments

As an example if Icreate a route like this: .add('searchPage', '/:region/:activity(for-sale|for-rent)/search', 'searchPage')

And the use: Router.pushRoute('searchPage', { ...updatedQuery, activity: query.activity, region: query.region }) If a user goes to the url writing For-Sale instead of for-sale, or it has any case difference, and then the user triggers a pushRoute, we get the following error:

image

Our temporary solution was to pass: Router.pushRoute('searchPage', { ...updatedQuery, activity: query.activity.toLowerCase, region: query.region })

juansalvatore avatar Dec 18 '19 20:12 juansalvatore