Langswitcher as parallel instead of Header. Using promise.all and added some Suspenses
This commit is contained in:
1
app/[lang]/(live)/@languageSwitcher/[...paths]/page.tsx
Normal file
1
app/[lang]/(live)/@languageSwitcher/[...paths]/page.tsx
Normal file
@@ -0,0 +1 @@
|
||||
export { default } from "../page"
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from "../../page"
|
||||
1
app/[lang]/(live)/@languageSwitcher/default.tsx
Normal file
1
app/[lang]/(live)/@languageSwitcher/default.tsx
Normal file
@@ -0,0 +1 @@
|
||||
export { default } from "./page"
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from "../../page"
|
||||
21
app/[lang]/(live)/@languageSwitcher/page.tsx
Normal file
21
app/[lang]/(live)/@languageSwitcher/page.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
import { Suspense } from "react"
|
||||
|
||||
import { serverClient } from "@/lib/trpc/server"
|
||||
|
||||
import LanguageSwitcher from "@/components/LanguageSwitcher"
|
||||
import { setLang } from "@/i18n/serverContext"
|
||||
|
||||
import { LangParams, PageArgs } from "@/types/params"
|
||||
|
||||
export default async function HeaderPage({ params }: PageArgs<LangParams>) {
|
||||
setLang(params.lang)
|
||||
const languages = await serverClient().contentstack.languageSwitcher.get()
|
||||
if (!languages) {
|
||||
return null
|
||||
}
|
||||
return (
|
||||
<Suspense>
|
||||
<LanguageSwitcher type="desktopHeader" urls={languages.urls} />
|
||||
</Suspense>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user