-
Notifications
You must be signed in to change notification settings - Fork 89
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
Add search params (query params) support #43
Conversation
This would be great to have! We built something around this @HiCommon |
This pull request is stale because it has been open 30 days with no activity. Remove no-pr-activity label or comment or this will be closed in 5 days. |
This pull request is stale because it has been open 30 days with no activity. |
} | ||
}); | ||
}; | ||
|
||
push = (step = this.nextStep) => this.history.push(`${this.basename}${step}`); | ||
replace = (step = this.nextStep) => this.history.replace(`${this.basename}${step}`); | ||
push = (step = this.nextStep) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
history.replace
and history.push
can accept a location-like object which will preserve query params. check out https://github.com/ReactTraining/history/tree/v4.6.0#navigation. Using this, you can remove historySuffix
and do something like this:
replace = (step = this.nextStep) => {
if (this.props.preserveSearch) {
this.history.replace({
...this.history.location,
pathname:`${this.basename}${step}`
})
} else {
this.history.replace(`${this.basename}${step}`);
}
}
@skoshy I know it's been forever. Apologies for no one getting to this faster. Are you still interested in working on this? |
This pull request is stale because it has been open 30 days with no activity. |
@ryhinchey I could continue if this is still needed and @skoshy is ok with it? |
Hi! I've lost context on this and am not working with the library recently, so someone else can feel free to take it over and close this PR. |
Closing until someone can pick this back up |
This option keeps URL search params in the history and prevents them from being overwritten when react-albus handles navigation. This handles issue #36.
This feature is very useful when you have a unique link identifier for a user and you want to preserve it in the URL so they can share it with others or return back to it with that data still present in the url.