1
1
mirror of https://github.com/theoludwig/theoludwig.git synced 2024-11-08 22:31:30 +01:00

fix: add missing unstable_setRequestLocale to enable static rendering

This commit is contained in:
Théo LUDWIG 2024-07-31 11:00:30 +02:00
parent c094b37bca
commit ceeeb2f9c5
Signed by: theoludwig
GPG Key ID: ADFE5A563D718F3B

View File

@ -3,10 +3,13 @@ import { notFound } from "next/navigation"
import { getBlogPostBySlug, getBlogPosts } from "@repo/blog"
import { BlogPostUI } from "@repo/blog/BlogPostUI"
import type { Locale } from "@repo/i18n/config"
import { unstable_setRequestLocale } from "next-intl/server"
interface BlogPostPageProps {
params: {
slug: string
locale: Locale
}
}
@ -47,6 +50,9 @@ export const generateStaticParams = async (): Promise<
const BlogPostPage: React.FC<BlogPostPageProps> = async (props) => {
const { params } = props
// Enable static rendering
unstable_setRequestLocale(params.locale)
const blogPost = await getBlogPostBySlug(params.slug)
if (blogPost == null) {
return notFound()