troch / route-node

A package to create a tree of named routes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

strictQueryParams not honored when building a path from segment

acolby opened this issue · comments

commented

I'm currently using router5-redux with the router5middleware with strictQueryParams set to false. Basically I want all routes to work for any query params. However, I noticed that when I hit the back button (navigating back to a route with query params that are NOT explicitly defined in the router) the params are stripped on transition success.

I traced it down to buildPathFromSegments in this repo. It doesn't look to see if strictQueryParams is false and allow the params that are passed in before creating the searchParams [].

Thank you very much for your hard work. I am a huge fan of the philosophy of router5 and appreciate it very much. Please advise.

Also, I'd be happy to toss up a PR.

Cheers!!

Hi @acolby, thanks for the kind words. I've just released 1.8.0. buildPath now passes options to buildPathFromSegments, which in turn will now add extra parameters to the URL if strictQueryParams is falsy (default to true).

router5 currently doesn't pass strictQueryParams to the buildPath function of its root node so I'm going to have to release a new version.

router5 v4.4.0 released, give me a shout if it doesn't behave as expected