Commit 1663d33f authored by Tim Neutkens's avatar Tim Neutkens

Remove another catch(err) return undefined case

parent 23740ac0
......@@ -119,19 +119,15 @@ export async function evalManifestWithRetries<T extends object>(
}
}
async function tryLoadClientReferenceManifest(
async function loadClientReferenceManifest(
manifestPath: string,
entryName: string,
attempts?: number
) {
try {
const context = await evalManifestWithRetries<{
__RSC_MANIFEST: { [key: string]: ClientReferenceManifest }
}>(manifestPath, attempts)
return context.__RSC_MANIFEST[entryName]
} catch (err) {
return undefined
}
const context = await evalManifestWithRetries<{
__RSC_MANIFEST: { [key: string]: ClientReferenceManifest }
}>(manifestPath, attempts)
return context.__RSC_MANIFEST[entryName]
}
/**
......@@ -196,7 +192,11 @@ async function loadComponentsImpl<N = any>({
}
// Make sure to avoid loading the manifest for static metadata routes for better performance.
const hasClientManifest = !isStaticMetadataRoute(page)
// TODO: We should not rely on the `page` in order to determine route type. `definition.kind` has this information for each bundle. The problem with ClientReferenceManifest is that it's used in `setReferenceManifestsSingleton` which has to run before the route itself is required.
const hasClientManifest =
!isStaticMetadataRoute(page) ||
// Temporary hack to exclude loading the clientReferenceManifest for Route Handlers.
page.endsWith('/route')
// Load the manifest files first
//
......@@ -223,7 +223,7 @@ async function loadComponentsImpl<N = any>({
manifestLoadAttempts
).catch(() => undefined),
isAppPath && hasClientManifest
? tryLoadClientReferenceManifest(
? loadClientReferenceManifest(
join(
distDir,
'server',
......
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