Merged in fix/suspense-key (pull request #1356)

feat: suspense key - use json-stable-stringify for suspense key

* feat: suspense key - use json-stable-stringify for suspense key


Approved-by: Joakim Jäderberg
This commit is contained in:
Linus Flood
2025-02-17 09:42:54 +00:00
parent c4ae9201db
commit 1116bdafa8
3 changed files with 12 additions and 11 deletions

View File

@@ -1,3 +1,4 @@
import stringify from "json-stable-stringify-without-jsonify"
import { Suspense } from "react"
import { SelectHotelMapContainer } from "@/components/HotelReservation/SelectHotel/SelectHotelMap/SelectHotelMapContainer"
@@ -16,11 +17,13 @@ export default async function SelectHotelMapPage({
}: PageArgs<LangParams, SelectHotelSearchParams>) {
setLang(params.lang)
const suspenseKey = stringify(searchParams)
return (
<div className={styles.main}>
<MapContainer>
<Suspense
key={JSON.stringify(searchParams)}
key={suspenseKey}
fallback={<SelectHotelMapContainerSkeleton />}
>
<SelectHotelMapContainer searchParams={searchParams} />

View File

@@ -1,3 +1,4 @@
import stringify from "json-stable-stringify-without-jsonify"
import { Suspense } from "react"
import SelectHotel from "@/components/HotelReservation/SelectHotel"
@@ -13,11 +14,10 @@ export default async function SelectHotelPage({
}: PageArgs<LangParams, SelectHotelSearchParams>) {
setLang(params.lang)
const suspenseKey = stringify(searchParams)
return (
<Suspense
key={JSON.stringify(searchParams)}
fallback={<SelectHotelSkeleton />}
>
<Suspense key={suspenseKey} fallback={<SelectHotelSkeleton />}>
<SelectHotel params={params} searchParams={searchParams} />
</Suspense>
)