mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
The issue was that DOM bots with PPR-enabled routes were being forced to use BLOCKING_STATIC_RENDER mode, which prevented them from using the fallback cache lookup mechanism. This caused them to generate new content with isRevalidating: true, which blocks postponed data and triggers the Math.random() static generation bailout error. For HTML bots, they keep using BLOCKING_STATIC_RENDER because SSG was turned off for them and won't see the SSG bailout error. For DOM bots, they should behave like a normal user. Fixes NAR-273
30 lines
669 B
TypeScript
30 lines
669 B
TypeScript
import React from 'react'
|
|
|
|
import type { Metadata } from 'next'
|
|
|
|
export async function generateMetadata(): Promise<Metadata> {
|
|
await new Promise((resolve) => setTimeout(resolve, 1000)) // Simulate a delay
|
|
return {
|
|
title: 'Home',
|
|
description: 'Welcome to the home page',
|
|
}
|
|
}
|
|
|
|
export default async function Home({
|
|
params,
|
|
}: {
|
|
params: Promise<{ slug: string }>
|
|
}) {
|
|
const { slug } = await params
|
|
// Math.random() will cause SSG_BAILOUT if static generation runs
|
|
// Bots should bypass static generation in PPR to avoid this error
|
|
const randomValue = Math.random()
|
|
|
|
return (
|
|
<>
|
|
<h1>{slug}</h1>
|
|
<p>{randomValue}</p>
|
|
</>
|
|
)
|
|
}
|