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

Clear previous search and hash on push/replace with pathname only #818

Closed
wants to merge 1 commit into from

Conversation

sachmata
Copy link

@sachmata sachmata commented Jul 17, 2020

When history.push or history.replace is called with string URL without search or hash part the ones from previous location are kept.

history.push('https://reacttraining.com/with-query?query=hello');

// https://reacttraining.com/with-query?query=hello -> This is OK
console.log(history.createHref(history.location));

// new route is pushed without search
history.push('https://reacttraining.com/no-query');

// https://reacttraining.com/no-query?query=hello -> Current result keeps the old search
console.log(history.createHref(history.location));

This change adds default empty values for search and hash which are replaced if parsePath function finds some.

If the previous search or hash have to be reused PartialPath object can be passed with omitted keys.

@jaydenseric
Copy link

Fixes #814 ?

@sachmata
Copy link
Author

sachmata commented Aug 3, 2020

Fixes #814 ?

Yes, I have missed that is already reported.

@Hypnosphi
Copy link

@mjackson can you please review?

@chaance chaance deleted the branch remix-run:master August 14, 2021 18:05
@chaance chaance closed this Aug 14, 2021
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.

4 participants