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

Edge case request - ability to opt out of urlencoding

Open brad-decker opened this issue 5 years ago • 6 comments

https://www.redfin.com/city/30818/TX/Austin/filter/min-price=100k,max-price=325k

I am building something that updates the state of the url based on a set of filters, Redfin's site is almost an exact match to my intended effect. The last 'route' portion is the /filter/ and everything after that are a series of filters that we are parsing and can be in any combination or order

Do you have a suggestion for how I can achieve this with next-routes? We are already using it but the problem is everything after filter/ gets urlencoded which produces some very ugly urls.

brad-decker avatar Sep 16 '18 01:09 brad-decker

+1

dekkofilms avatar Sep 17 '18 22:09 dekkofilms

Was looking into a similar case for nextjs before (comma separated querystring values getting uri encoded).

I believe the encoding and url formatting is done by a dependecy of nextjs: https://www.npmjs.com/package/url

Anyways I decided to just use _ as separator for now. Here you can see what character are not encoded by encodeURIComponent

HeyHugo avatar Sep 28 '18 12:09 HeyHugo

@HeyHugo https://github.com/fridays/next-routes/blob/master/src/index.js#L172 is where the encoding is happening, i think. Do you feel differently?

brad-decker avatar Sep 28 '18 15:09 brad-decker

Ah you're right. I didn't check so carefully and assumed it was using the Router.push / Router.replace of nextjs which I found was using the url package.

HeyHugo avatar Sep 28 '18 18:09 HeyHugo

@brad-decker Did you ever find a solution for this? I am in the same situation and can't seem to find a graceful way around the encoding.

ellioseven avatar Dec 10 '18 06:12 ellioseven

+1

DonStanislas avatar Jul 14 '19 10:07 DonStanislas