Skip to content

Commit

Permalink
fix: search params persisting on redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob-ebey committed Nov 1, 2021
1 parent bb756f4 commit 3095a04
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
11 changes: 11 additions & 0 deletions packages/history/__tests__/TestSequences/ReplaceNewLocation.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ export default (history, done) => {
state: null,
key: expect.any(String)
});

history.replace('/');
},
({ action, location }) => {
expect(action).toBe('REPLACE');
expect(location).toMatchObject({
pathname: '/',
search: '',
state: null,
key: expect.any(String)
});
}
];

Expand Down
4 changes: 3 additions & 1 deletion packages/history/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,9 @@ export function createPath({
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#parsepath
*/
export function parsePath(path: string) {
let partialPath: PartialPath = {};
let partialPath: PartialPath = {
search: ''
};

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

0 comments on commit 3095a04

Please sign in to comment.