peppa/apps/web/lib/boot.ts
Асель c739e877f5 PEP-114: a page opened before the site was updated asks to be reloaded
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-15 15:58:52 +05:00

10 lines
514 B
TypeScript

// PEP-114: one id per start of the web process (shared by pages and route handlers through
// globalThis). A page keeps the id it was rendered with; when /api/health reports another one,
// the server was restarted with new code and the page's buttons may no longer be known to it.
const g = globalThis as typeof globalThis & { __peppaBoot?: string };
export function bootId(): string {
g.__peppaBoot ??= `${process.env.NEXT_PUBLIC_PEPPA_COMMIT ?? "dev"}-${Date.now().toString(36)}`;
return g.__peppaBoot;
}