Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 03209d8

Browse files
committed
Fix some issues related to rendering.
1 parent e3d68ff commit 03209d8

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

client/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ const {
3131
location
3232
} = window
3333

34-
window.NEXT_PAGE_LOADER = new PageLoader(buildId)
35-
34+
const pageLoader = window.NEXT_PAGE_LOADER = new PageLoader(buildId)
3635
const Component = evalScript(component).default
3736
const ErrorComponent = evalScript(errorComponent).default
3837
let lastAppProps
3938

4039
export const router = createRouter(pathname, query, getURL(), {
40+
pageLoader,
4141
Component,
4242
ErrorComponent,
4343
err

lib/router/router.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global NEXT_PAGE_LOADER */
2-
31
import { parse, format } from 'url'
42
import mitt from 'mitt'
53
import shallowEquals from '../shallow-equals'
@@ -10,7 +8,7 @@ import { _notifyBuildIdMismatch } from './'
108
const webpackModule = module
119

1210
export default class Router {
13-
constructor (pathname, query, as, { Component, ErrorComponent, err } = {}) {
11+
constructor (pathname, query, as, { pageLoader, Component, ErrorComponent, err } = {}) {
1412
// represents the current component key
1513
this.route = toRoute(pathname)
1614

@@ -26,6 +24,7 @@ export default class Router {
2624
// Handling Router Events
2725
this.events = mitt()
2826

27+
this.pageLoader = pageLoader
2928
this.prefetchQueue = new PQueue({ concurrency: 2 })
3029
this.ErrorComponent = ErrorComponent
3130
this.pathname = pathname
@@ -80,7 +79,7 @@ export default class Router {
8079

8180
async reload (route) {
8281
delete this.components[route]
83-
NEXT_PAGE_LOADER.clearCache(route)
82+
this.pageLoader.clearCache(route)
8483

8584
if (route !== this.route) return
8685

@@ -335,7 +334,7 @@ export default class Router {
335334
})
336335
}
337336

338-
return await NEXT_PAGE_LOADER.loadPage(route)
337+
return await this.pageLoader.loadPage(route)
339338
}
340339

341340
abortComponentLoad (as) {

server/build/plugins/pages-plugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default class PagesPlugin {
1212
pages.forEach((chunk) => {
1313
const page = compilation.assets[chunk.name]
1414
const pageName = matchRouteName.exec(chunk.name)[1]
15-
const routeName = `/${pageName.replace(/index$/, '')}`
15+
const routeName = `/${pageName.replace(/[/\\]index$/, '')}`
1616

1717
const content = page.source()
1818
const newContent = `

0 commit comments

Comments
 (0)