web: render the 404 text on the client

not-found is prerendered in the build-time locale, so a reader whose
browser picks another locale hit a hydration mismatch. Render the
translated text after mount instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Merve DALĞIN
2026-11-18 22:03:52 +03:00
co-authored by Claude Opus 5.5
parent a2445e3551
commit e59d396f20
+7
View File
@@ -1,11 +1,18 @@
"use client";
import { useEffect, useState } from "react";
import Link from "next/link";
import { Button } from "@/components/ui/button";
import { t } from "@/i18n";
export default function NotFound() {
// This page is prerendered in the build-time locale; render the text only on the
// client so a reader in another locale gets no hydration mismatch.
const [mounted, setMounted] = useState(false);
useEffect(() => setMounted(true), []);
if (!mounted) return <div className="h-dvh" />;
return (
<div className="flex h-dvh flex-col items-center justify-center space-y-2 text-center">
<h1 className="font-semibold text-2xl">{t("Page not found.")}</h1>