Skip to content

Commit

Permalink
Merge pull request #902 from remix-run/jacob/rem-473-redirects-after-…
Browse files Browse the repository at this point in the history
…action-are-persisting

fix: search params persisting on redirects
  • Loading branch information
ryanflorence authored Nov 1, 2021
2 parents bb756f4 + 3095a04 commit 2d5c85e
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 2d5c85e

Please sign in to comment.