Skip to content

Commit

Permalink
chore: tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
pengzhanbo committed May 19, 2024
1 parent da2436d commit 2b77a53
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 2 additions & 4 deletions packages/client/src/router/createVueRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@ export const createVueRouter = (): Router => {
// and save page data to route meta
router.beforeResolve(async (to, from): Promise<string | void> => {
if (to.path !== from.path || from === START_LOCATION) {
const fullPath = to.fullPath.split(/#|\?/)[0]
const route = resolveRoute(fullPath)

if (route.path !== fullPath) {
const route = resolveRoute(to.fullPath)
if (route.path !== to.fullPath) {
return route.path
}
const pageChunk = await route.loader()
Expand Down
3 changes: 2 additions & 1 deletion packages/client/src/router/resolveRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export const resolveRoute = <T extends RouteMeta = RouteMeta>(
currentPath?: string,
): ResolvedRoute<T> => {
const routePath = resolveRoutePath(path, currentPath)
const route = routes.value[routePath] ?? {
const pathname = routePath.split(/#|\?/)[0]
const route = routes.value[pathname] ?? {
...routes.value['/404.html'],
notFound: true,
}
Expand Down

0 comments on commit 2b77a53

Please sign in to comment.