Commit bd2e8732 authored by Jiachi Liu's avatar Jiachi Liu

refactor: remove duplicated conditions

parent 2f5dbd94
...@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment