10 lines
514 B
TypeScript
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;
|
|
}
|