Skip to content

Commit

Permalink
Remove the options object from decodeLocation
Browse files Browse the repository at this point in the history
  • Loading branch information
zoontek committed Jan 2, 2024
1 parent 095f0aa commit e5eb670
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 2 additions & 5 deletions __tests__/location.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@ import { decodeLocation } from "../src/history";
const getEqual =
(removeExtraPathSlashes: boolean) =>
<E>(path: string, sanitized: string, location: E) => {
const { toString, ...value } = decodeLocation(path, {
removeExtraPathSlashes,
});

expect(toString()).toStrictEqual(sanitized);
const { toString, ...value } = decodeLocation(path, removeExtraPathSlashes);
expect(value).toStrictEqual(location);
expect(toString()).toStrictEqual(sanitized);
};

test("decodeLocation parses well-formed paths properly", () => {
Expand Down
4 changes: 2 additions & 2 deletions src/history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let initialLocationHasChanged = false;

export const decodeLocation = (
url: string,
{ removeExtraPathSlashes = false }: { removeExtraPathSlashes?: boolean } = {},
removeExtraPathSlashes = false,
): Location => {
const route = parseRoute(url);
const path = route.path.substring(1);
Expand Down Expand Up @@ -54,7 +54,7 @@ export const createBrowserHistory = () => {

let currentLocation = decodeLocation(
globalLocation.pathname + globalLocation.search,
{ removeExtraPathSlashes: true },
true,
);

const maybeUpdateLocation = (nextLocation: Location) => {
Expand Down

0 comments on commit e5eb670

Please sign in to comment.