Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

match segment if remainingPath only consist of unknown qsParams #1

Merged
merged 1 commit into from
Jan 1, 2016
Merged

match segment if remainingPath only consist of unknown qsParams #1

merged 1 commit into from
Jan 1, 2016

Conversation

jamuhl
Copy link
Contributor

@jamuhl jamuhl commented Dec 17, 2015

first let me thank you for router5...we right now try to move to router5 from react-router - but encounter one issue that makes it harder then needed for us.

  1. we have a lot of querystring params across our app that acts more global then route specific, eg:
    ?lng=...
    ?debug=...

  2. we got qs params that act more on some react component, like eg. preselecting some filter

both have in common, that we don't want them to be defined on the route.

sample:
router.addNode('userModify', '/user/modify/:userId')
open http://localhost/user/modifiy/1234?lng=de would result in not found route.

this PR would change it so if a remainingPath in getSegmentsMatchingPath will be ignored if only consist of unmatched querystring params. Personally i think it would make more sense this way. See changed test in commit.

@troch
Copy link
Owner

troch commented Dec 17, 2015

Thank you for your PR, I'll review it as quick as I can (might be early next week as I have little time until next week). In the meantime, if you need it urgently, you can use npm's shrinkwrap functionality.

It supports one of my cases too, I am thinking of adding special query parameters which would persist on navigation.

@jamuhl
Copy link
Contributor Author

jamuhl commented Dec 17, 2015

No need to rush...and thanks for reviewing.

@troch
Copy link
Owner

troch commented Jan 1, 2016

I am merging it but will modify it to make it an option.

troch added a commit that referenced this pull request Jan 1, 2016
match segment if remainingPath only consist of unknown qsParams
@troch troch merged commit 5940b2c into troch:master Jan 1, 2016
@troch
Copy link
Owner

troch commented Jan 1, 2016

router5@1.3.0 was released, with support for strictQueryParams option (default to true). Set to false for allowing extra query parameters and still match.

http://router5.github.io/docs/router-options.html#strict-query-parameters

@jamuhl
Copy link
Contributor Author

jamuhl commented Jan 1, 2016

great...thanks a lot...

@troch troch mentioned this pull request Jan 16, 2016
21 tasks
troch added a commit that referenced this pull request Aug 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants