Merged in fix/book-682-select-hotel-filter-jank (pull request #3362)
fix(BOOK-682): Select Hotel jank * Remove ChildrenWrapper Approved-by: Linus Flood
This commit is contained in:
@@ -1,22 +1,7 @@
|
|||||||
import { Suspense } from "react"
|
|
||||||
|
|
||||||
import ChildrenWrapper from "@/components/ChildrenWrapper"
|
|
||||||
|
|
||||||
import styles from "./layout.module.css"
|
import styles from "./layout.module.css"
|
||||||
|
|
||||||
export default function AlternativeHotelsLayout({
|
export default function AlternativeHotelsLayout({
|
||||||
children,
|
children,
|
||||||
}: React.PropsWithChildren) {
|
}: React.PropsWithChildren) {
|
||||||
return (
|
return <div className={styles.layout}>{children}</div>
|
||||||
<div className={styles.layout}>
|
|
||||||
{/*
|
|
||||||
This Suspense is only needed to prevent useSearchParams from
|
|
||||||
making everything rendered client-side
|
|
||||||
https://nextjs.org/docs/14/app/api-reference/functions/use-search-params#static-rendering
|
|
||||||
*/}
|
|
||||||
<Suspense fallback={null}>
|
|
||||||
<ChildrenWrapper>{children}</ChildrenWrapper>
|
|
||||||
</Suspense>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,7 @@
|
|||||||
import { Suspense } from "react"
|
|
||||||
|
|
||||||
import ChildrenWrapper from "@/components/ChildrenWrapper"
|
|
||||||
|
|
||||||
import styles from "./layout.module.css"
|
import styles from "./layout.module.css"
|
||||||
|
|
||||||
export default function SelectHotelLayout({
|
export default function SelectHotelLayout({
|
||||||
children,
|
children,
|
||||||
}: React.PropsWithChildren) {
|
}: React.PropsWithChildren) {
|
||||||
return (
|
return <div className={styles.layout}>{children}</div>
|
||||||
<div className={styles.layout}>
|
|
||||||
{/*
|
|
||||||
This Suspense is only needed to prevent useSearchParams from
|
|
||||||
making everything rendered client-side
|
|
||||||
https://nextjs.org/docs/14/app/api-reference/functions/use-search-params#static-rendering
|
|
||||||
*/}
|
|
||||||
<Suspense fallback={null}>
|
|
||||||
<ChildrenWrapper>{children}</ChildrenWrapper>
|
|
||||||
</Suspense>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
"use client"
|
|
||||||
import { useSearchParams } from "next/navigation"
|
|
||||||
import { Fragment } from "react"
|
|
||||||
|
|
||||||
// Solution derived from leerobs example
|
|
||||||
// https://github.com/vercel/next.js/issues/53543#issuecomment-2327883526
|
|
||||||
// Ensure children are re-rendered when the search query changes
|
|
||||||
export default function ChildrenWrapper({ children }: React.PropsWithChildren) {
|
|
||||||
const searchParams = useSearchParams()
|
|
||||||
return <Fragment key={searchParams.toString()}>{children}</Fragment>
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user