Skip to content

Commit

Permalink
fix: remove false search returns in parsePath
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanflorence committed Nov 1, 2021
1 parent ed674b5 commit a2a2c72
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions packages/history/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,9 @@ export function createBrowserHistory(
// state defaults to `null` because `window.history.state` does
function getNextLocation(to: To, state: any = null): Location {
return readOnly<Location>({
...location,
pathname: location.pathname,
hash: '',
search: '',
...(typeof to === 'string' ? parsePath(to) : to),
state,
key: createKey()
Expand Down Expand Up @@ -680,7 +682,9 @@ export function createHashHistory(

function getNextLocation(to: To, state: any = null): Location {
return readOnly<Location>({
...location,
pathname: location.pathname,
hash: '',
search: '',
...(typeof to === 'string' ? parsePath(to) : to),
state,
key: createKey()
Expand Down Expand Up @@ -876,7 +880,9 @@ export function createMemoryHistory(

function getNextLocation(to: To, state: any = null): Location {
return readOnly<Location>({
...location,
pathname: location.pathname,
search: '',
hash: '',
...(typeof to === 'string' ? parsePath(to) : to),
state,
key: createKey()
Expand Down Expand Up @@ -1044,9 +1050,7 @@ export function createPath({
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#parsepath
*/
export function parsePath(path: string): PartialPath {
let parsedPath: PartialPath = {
search: ''
};
let parsedPath: PartialPath = {};

if (path) {
let hashIndex = path.indexOf('#');
Expand Down

0 comments on commit a2a2c72

Please sign in to comment.