mirror of
https://github.com/theoludwig/theoludwig.git
synced 2024-12-08 00:44:30 +01:00
fix: add missing unstable_setRequestLocale to enable static rendering
This commit is contained in:
parent
c094b37bca
commit
ceeeb2f9c5
@ -3,10 +3,13 @@ import { notFound } from "next/navigation"
|
|||||||
|
|
||||||
import { getBlogPostBySlug, getBlogPosts } from "@repo/blog"
|
import { getBlogPostBySlug, getBlogPosts } from "@repo/blog"
|
||||||
import { BlogPostUI } from "@repo/blog/BlogPostUI"
|
import { BlogPostUI } from "@repo/blog/BlogPostUI"
|
||||||
|
import type { Locale } from "@repo/i18n/config"
|
||||||
|
import { unstable_setRequestLocale } from "next-intl/server"
|
||||||
|
|
||||||
interface BlogPostPageProps {
|
interface BlogPostPageProps {
|
||||||
params: {
|
params: {
|
||||||
slug: string
|
slug: string
|
||||||
|
locale: Locale
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,6 +50,9 @@ export const generateStaticParams = async (): Promise<
|
|||||||
const BlogPostPage: React.FC<BlogPostPageProps> = async (props) => {
|
const BlogPostPage: React.FC<BlogPostPageProps> = async (props) => {
|
||||||
const { params } = props
|
const { params } = props
|
||||||
|
|
||||||
|
// Enable static rendering
|
||||||
|
unstable_setRequestLocale(params.locale)
|
||||||
|
|
||||||
const blogPost = await getBlogPostBySlug(params.slug)
|
const blogPost = await getBlogPostBySlug(params.slug)
|
||||||
if (blogPost == null) {
|
if (blogPost == null) {
|
||||||
return notFound()
|
return notFound()
|
||||||
|
Loading…
Reference in New Issue
Block a user