Skip to content

Commit

Permalink
Update to re-use toRoute method
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Jan 17, 2020
1 parent 1224c39 commit cab730c
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions packages/next/next-server/lib/router/router.ts
Expand Up @@ -666,12 +666,7 @@ export default class Router implements BaseRouter {

_getStaticData = (asPath: string, _cachedData?: object): Promise<object> => {
let pathname = parse(asPath).pathname
pathname = !pathname || pathname === '/' ? '/index' : pathname

// remove trailing slash from path
if (pathname.substr(pathname.length - 1) === '/') {
pathname = pathname.substr(0, pathname.length - 1)
}
pathname = toRoute(!pathname || pathname === '/' ? '/index' : pathname)

return process.env.NODE_ENV === 'production' &&
(_cachedData = this.sdc[pathname])
Expand Down

0 comments on commit cab730c

Please sign in to comment.