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
bd2e8732
Commit
bd2e8732
authored
Oct 31, 2023
by
Jiachi Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: remove duplicated conditions
parent
2f5dbd94
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
17 deletions
+9
-17
on-demand-entry-handler.ts
packages/next/src/server/dev/on-demand-entry-handler.ts
+9
-17
No files found.
packages/next/src/server/dev/on-demand-entry-handler.ts
View file @
bd2e8732
...
@@ -674,13 +674,11 @@ export function onDemandEntryHandler({
...
@@ -674,13 +674,11 @@ export function onDemandEntryHandler({
async
function
ensurePageImpl
({
async
function
ensurePageImpl
({
page
,
page
,
clientOnly
,
appPaths
,
appPaths
,
definition
,
definition
,
isApp
,
isApp
,
}:
{
}:
{
page
:
string
page
:
string
clientOnly
:
boolean
appPaths
:
ReadonlyArray
<
string
>
|
null
appPaths
:
ReadonlyArray
<
string
>
|
null
definition
:
RouteDefinition
|
undefined
definition
:
RouteDefinition
|
undefined
isApp
:
boolean
|
undefined
isApp
:
boolean
|
undefined
...
@@ -834,7 +832,7 @@ export function onDemandEntryHandler({
...
@@ -834,7 +832,7 @@ export function onDemandEntryHandler({
const
hasNewEntry
=
addedValues
.
some
((
entry
)
=>
entry
.
newEntry
)
const
hasNewEntry
=
addedValues
.
some
((
entry
)
=>
entry
.
newEntry
)
if
(
hasNewEntry
)
{
if
(
hasNewEntry
)
{
reportTrigger
(
!
clientOnly
&&
hasNewEntry
?
`
${
route
.
page
}
`
:
route
.
page
)
reportTrigger
(
route
.
page
)
}
}
if
(
entriesThatShouldBeInvalidated
.
length
>
0
)
{
if
(
entriesThatShouldBeInvalidated
.
length
>
0
)
{
...
@@ -874,7 +872,6 @@ export function onDemandEntryHandler({
...
@@ -874,7 +872,6 @@ export function onDemandEntryHandler({
type
EnsurePageOptions
=
{
type
EnsurePageOptions
=
{
page
:
string
page
:
string
clientOnly
:
boolean
appPaths
?:
ReadonlyArray
<
string
>
|
null
appPaths
?:
ReadonlyArray
<
string
>
|
null
definition
?:
RouteDefinition
definition
?:
RouteDefinition
isApp
?:
boolean
isApp
?:
boolean
...
@@ -898,7 +895,6 @@ export function onDemandEntryHandler({
...
@@ -898,7 +895,6 @@ export function onDemandEntryHandler({
return
{
return
{
async
ensurePage
({
async
ensurePage
({
page
,
page
,
clientOnly
,
appPaths
=
null
,
appPaths
=
null
,
definition
,
definition
,
isApp
,
isApp
,
...
@@ -912,18 +908,14 @@ export function onDemandEntryHandler({
...
@@ -912,18 +908,14 @@ export function onDemandEntryHandler({
// Wrap the invocation of the ensurePageImpl function in the pending
// Wrap the invocation of the ensurePageImpl function in the pending
// wrapper, which will ensure that we don't have multiple compilations
// wrapper, which will ensure that we don't have multiple compilations
// for the same page happening concurrently.
// for the same page happening concurrently.
return
batcher
.
batch
(
return
batcher
.
batch
({
page
,
appPaths
,
definition
,
isApp
},
async
()
=>
{
{
page
,
clientOnly
,
appPaths
,
definition
,
isApp
},
async
()
=>
{
await
ensurePageImpl
({
await
ensurePageImpl
({
page
,
page
,
clientOnly
,
appPaths
,
appPaths
,
definition
,
definition
,
isApp
,
isApp
,
})
})
}
})
)
},
},
onHMR
(
client
:
ws
,
getHmrServerError
:
()
=>
Error
|
null
)
{
onHMR
(
client
:
ws
,
getHmrServerError
:
()
=>
Error
|
null
)
{
let
bufferedHmrServerError
:
Error
|
null
=
null
let
bufferedHmrServerError
:
Error
|
null
=
null
...
...
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