Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyfromundefined committed May 22, 2024
1 parent 6c85f4b commit 28655b2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
6 changes: 3 additions & 3 deletions extensions/plugin-history-sync/src/historySyncPlugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
import { last } from "./last";
import { makeHistoryTaskQueue } from "./makeHistoryTaskQueue";
import type { UrlPatternOptions } from "./makeTemplate";
import { makeTemplate, pathToUrl } from "./makeTemplate";
import { makeTemplate, pathToUrl, urlSearchParamsToMap } from "./makeTemplate";
import { normalizeActivityRouteMap } from "./normalizeActivityRouteMap";
import type { RouteLike } from "./RouteLike";
import { RoutesProvider } from "./RoutesContext";
Expand Down Expand Up @@ -142,8 +142,8 @@ export function historySyncPlugin<
(r) => r.activityName === fallbackActivityName,
);
const fallbackActivityPath = fallbackActivityRoute?.path;
const fallbackActivityParams = Object.fromEntries(
pathToUrl(currentPath).searchParams.entries(),
const fallbackActivityParams = urlSearchParamsToMap(
pathToUrl(currentPath).searchParams,
);

return [
Expand Down
10 changes: 2 additions & 8 deletions extensions/plugin-history-sync/src/makeTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,8 @@ export function pathToUrl(path: string) {
return new URL(path, "file://");
}

function urlSearchParamsToMap(urlSearchParams: URLSearchParams) {
const map: { [key: string]: any } = {};

urlSearchParams.forEach((value, key) => {
map[key] = value;
});

return map;
export function urlSearchParamsToMap(urlSearchParams: URLSearchParams) {
return Object.fromEntries(urlSearchParams.entries());
}

function appendTrailingSlashInPathname(pathname: string) {
Expand Down

0 comments on commit 28655b2

Please sign in to comment.