Merged in feature/bookingwidget-client-side (pull request #1481)
Move more of BookingWidget to client SW-1639 * feat: move getLocations in booking widget to client side so that it's also cached on the client reducing the blinking when switching urls (and reducing duplicate calls) Approved-by: Linus Flood
This commit is contained in:
@@ -1,16 +1,9 @@
|
||||
import {
|
||||
getLocations,
|
||||
isBookingWidgetHidden,
|
||||
} from "@/lib/trpc/memoizedRequests"
|
||||
import { isBookingWidgetHidden } from "@/lib/trpc/memoizedRequests"
|
||||
|
||||
import BookingWidgetClient from "./Client"
|
||||
|
||||
import type { BookingWidgetProps } from "@/types/components/bookingWidget"
|
||||
|
||||
export function preload() {
|
||||
void getLocations()
|
||||
}
|
||||
|
||||
export default async function BookingWidget({
|
||||
type,
|
||||
bookingWidgetSearchParams,
|
||||
@@ -21,15 +14,8 @@ export default async function BookingWidget({
|
||||
return null
|
||||
}
|
||||
|
||||
const locations = await getLocations()
|
||||
|
||||
if (!locations || "error" in locations) {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<BookingWidgetClient
|
||||
locations={locations.data}
|
||||
type={type}
|
||||
bookingWidgetSearchParams={bookingWidgetSearchParams}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user