fix: make sure all searchparams are used in redirect

This commit is contained in:
Simon Emanuelsson
2024-11-19 11:24:17 +01:00
committed by Simon.Emanuelsson
parent 1b3999a050
commit 744af22b08
9 changed files with 65 additions and 49 deletions

View File

@@ -1,4 +1,5 @@
"use client"
import { useRouter } from "next/navigation"
import { useRef } from "react"
import { useDetailsStore } from "@/stores/details"
@@ -14,6 +15,7 @@ export default function StepsProvider({
breakfastPackages,
children,
isMember,
searchParams,
step,
}: StepsProviderProps) {
const storeRef = useRef<StepsStore>()
@@ -21,6 +23,7 @@ export default function StepsProvider({
const updateBreakfast = useDetailsStore(
(state) => state.actions.updateBreakfast
)
const router = useRouter()
if (!storeRef.current) {
const noBedChoices = bedTypes.length === 1
@@ -41,7 +44,9 @@ export default function StepsProvider({
step,
isMember,
noBedChoices,
noBreakfast
noBreakfast,
searchParams,
router.push
)
}