Skip to content

Commit

Permalink
Fix repeating hash
Browse files Browse the repository at this point in the history
  • Loading branch information
doasync committed Sep 22, 2020
1 parent c2efcde commit 485129d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const compileRoute = <

const pathname = createCompile<P>(route.config.path, options)(params);
const search = queryString ? `?${queryString}` : '';
const hashSign = !hash || hash.startsWith('#') ? '' : `#${hash}`;
const hashSign = !hash || hash.startsWith('#') ? '' : `#`;
return `${pathname}${search}${hashSign}${hash ?? ''}`;
};

Expand Down
4 changes: 2 additions & 2 deletions src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
Update,
} from 'history';

import { createMergedRoute, createRoute } from './route';
import {
Delta,
MergedRoute,
Expand All @@ -24,7 +25,6 @@ import {
historyChanger,
reduceStore,
} from './utils';
import { createRoute, createMergedRoute } from './route';

export const createRouter = <Q extends Query = Query, S extends State = State>({
history: userHistory,
Expand Down Expand Up @@ -102,7 +102,7 @@ export const createRouter = <Q extends Query = Query, S extends State = State>({
): Route<P, Router<Q, S>> => {
const routeConfig =
typeof pathConfig === 'string' ? { path: pathConfig } : pathConfig;
// @ts-ignore
// @ts-expect-error
const route = createRoute<P, Router<Q, S>>(router, routeConfig);
connectRoute(route);
return route;
Expand Down

0 comments on commit 485129d

Please sign in to comment.