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>( ...@@ -119,19 +119,15 @@ export async function evalManifestWithRetries<T extends object>(
} }
} }
async function tryLoadClientReferenceManifest( async function loadClientReferenceManifest(
manifestPath: string, manifestPath: string,
entryName: string, entryName: string,
attempts?: number attempts?: number
) { ) {
try {
const context = await evalManifestWithRetries<{ const context = await evalManifestWithRetries<{
__RSC_MANIFEST: { [key: string]: ClientReferenceManifest } __RSC_MANIFEST: { [key: string]: ClientReferenceManifest }
}>(manifestPath, attempts) }>(manifestPath, attempts)
return context.__RSC_MANIFEST[entryName] return context.__RSC_MANIFEST[entryName]
} catch (err) {
return undefined
}
} }
/** /**
...@@ -196,7 +192,11 @@ async function loadComponentsImpl<N = any>({ ...@@ -196,7 +192,11 @@ async function loadComponentsImpl<N = any>({
} }
// Make sure to avoid loading the manifest for static metadata routes for better performance. // 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 // Load the manifest files first
// //
...@@ -223,7 +223,7 @@ async function loadComponentsImpl<N = any>({ ...@@ -223,7 +223,7 @@ async function loadComponentsImpl<N = any>({
manifestLoadAttempts manifestLoadAttempts
).catch(() => undefined), ).catch(() => undefined),
isAppPath && hasClientManifest isAppPath && hasClientManifest
? tryLoadClientReferenceManifest( ? loadClientReferenceManifest(
join( join(
distDir, distDir,
'server', '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