fix: keep empty preview visible before hydration

This commit is contained in:
2026-09-08 23:34:56 +03:00
parent 51ab6579a2
commit 8aa147c25a
5 changed files with 36 additions and 17 deletions

View File

@@ -0,0 +1,27 @@
import { readFile } from "node:fs/promises";
import { resolve } from "node:path";
const outputPath = resolve(".next/server/app/index.html");
const html = await readFile(outputPath, "utf8");
// The placeholder is the first frame for a newly-created project. It must stay
// visible when a client chunk is delayed or rejected; later product pages are
// free to replace it and choose their own bounded animation policy.
if (html.includes("Fluw template")) {
const main = html.match(/<main\b[\s\S]*?<\/main>/i)?.[0];
if (!main) {
throw new Error("Fluw placeholder is missing its main landmark");
}
if (
/style="[^"]*(?:opacity\s*:\s*0(?:[;"]|\s)|visibility\s*:\s*hidden|display\s*:\s*none)/i.test(
main,
)
) {
throw new Error(
"Fluw placeholder hides content before client hydration; keep the first frame visible",
);
}
}
console.log("No-JS preview visibility verified");