Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
450277f2
Commit
450277f2
authored
May 09, 2017
by
Arunoda Susiripala
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure next export doesn't break other modes.
parent
147a5ce6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
1 deletion
+9
-1
page-loader.js
lib/page-loader.js
+5
-0
index.js
server/index.js
+1
-1
router.test.js
test/unit/router.test.js
+3
-0
No files found.
lib/page-loader.js
View file @
450277f2
...
@@ -105,5 +105,10 @@ export default class PageLoader {
...
@@ -105,5 +105,10 @@ export default class PageLoader {
route
=
this
.
normalizeRoute
(
route
)
route
=
this
.
normalizeRoute
(
route
)
delete
this
.
pageCache
[
route
]
delete
this
.
pageCache
[
route
]
delete
this
.
loadingRoutes
[
route
]
delete
this
.
loadingRoutes
[
route
]
const
script
=
document
.
getElementById
(
`__NEXT_PAGE__
${
route
}
`
)
if
(
script
)
{
script
.
parentNode
.
removeChild
(
script
)
}
}
}
}
}
server/index.js
View file @
450277f2
...
@@ -123,7 +123,7 @@ export default class Server {
...
@@ -123,7 +123,7 @@ export default class Server {
await
this
.
serveStatic
(
req
,
res
,
p
)
await
this
.
serveStatic
(
req
,
res
,
p
)
},
},
'/_next/:buildId/page/_error'
:
async
(
req
,
res
,
params
)
=>
{
'/_next/:buildId/page/_error
*
'
:
async
(
req
,
res
,
params
)
=>
{
if
(
!
this
.
handleBuildId
(
params
.
buildId
,
res
))
{
if
(
!
this
.
handleBuildId
(
params
.
buildId
,
res
))
{
const
error
=
new
Error
(
'INVALID_BUILD_ID'
)
const
error
=
new
Error
(
'INVALID_BUILD_ID'
)
const
customFields
=
{
buildIdMismatched
:
true
}
const
customFields
=
{
buildIdMismatched
:
true
}
...
...
test/unit/router.test.js
View file @
450277f2
...
@@ -20,6 +20,7 @@ describe('Router', () => {
...
@@ -20,6 +20,7 @@ describe('Router', () => {
const
request
=
{
clone
:
()
=>
null
}
const
request
=
{
clone
:
()
=>
null
}
describe
(
'.prefetch()'
,
()
=>
{
describe
(
'.prefetch()'
,
()
=>
{
it
(
'should prefetch a given page'
,
async
()
=>
{
it
(
'should prefetch a given page'
,
async
()
=>
{
global
.
__NEXT_DATA__
=
{}
const
pageLoader
=
new
PageLoader
()
const
pageLoader
=
new
PageLoader
()
const
router
=
new
Router
(
'/'
,
{},
'/'
,
{
pageLoader
})
const
router
=
new
Router
(
'/'
,
{},
'/'
,
{
pageLoader
})
const
route
=
'/routex'
const
route
=
'/routex'
...
@@ -29,6 +30,7 @@ describe('Router', () => {
...
@@ -29,6 +30,7 @@ describe('Router', () => {
})
})
it
(
'should only run two jobs at a time'
,
async
()
=>
{
it
(
'should only run two jobs at a time'
,
async
()
=>
{
global
.
__NEXT_DATA__
=
{}
// delay loading pages for an hour
// delay loading pages for an hour
const
pageLoader
=
new
PageLoader
({
delay
:
1000
*
3600
})
const
pageLoader
=
new
PageLoader
({
delay
:
1000
*
3600
})
const
router
=
new
Router
(
'/'
,
{},
'/'
,
{
pageLoader
})
const
router
=
new
Router
(
'/'
,
{},
'/'
,
{
pageLoader
})
...
@@ -46,6 +48,7 @@ describe('Router', () => {
...
@@ -46,6 +48,7 @@ describe('Router', () => {
})
})
it
(
'should run all the jobs'
,
async
()
=>
{
it
(
'should run all the jobs'
,
async
()
=>
{
global
.
__NEXT_DATA__
=
{}
const
pageLoader
=
new
PageLoader
()
const
pageLoader
=
new
PageLoader
()
const
router
=
new
Router
(
'/'
,
{},
'/'
,
{
pageLoader
})
const
router
=
new
Router
(
'/'
,
{},
'/'
,
{
pageLoader
})
const
routes
=
[
'route1'
,
'route2'
,
'route3'
,
'route4'
]
const
routes
=
[
'route1'
,
'route2'
,
'route3'
,
'route4'
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment