import { dehydrate, HydrationBoundary } from '@tanstack/react-query'; import { Metadata } from 'next'; import Link from 'next/link'; import { redirect } from 'next/navigation'; import JsonLd from '@/components/JsonLd'; import randomQuery, { generatePage } from '@/data/queries/random'; import { SITE_URL, TITLE } from '@/env'; import getQueryClient from '@/lib/queryClient'; import Container from './container'; interface SearchParams { type?: string; } export const metadata: Metadata = { alternates: { canonical: '/' } }; const Random = async ({ searchParams }: { searchParams: SearchParams }) => { if (searchParams.type === 'tv') redirect('/series'); const queryClient = getQueryClient(); const page = generatePage('movie'); await queryClient.prefetchInfiniteQuery(randomQuery({ page, type: 'movie' })); return (

{TITLE} — Discover Your Next Favorite Movie

Discover your next favorite movie

{TITLE} helps you decide what to watch: spin through random movie and series recommendations right on this page, browse the{' '} most popular movies {' '} everyone is talking about, or dive into the{' '} top-rated films {' '} of all time. Open any title to see its rating, overview, cast, and similar shows — and keep favorites and a watchlist so you never lose track of what to watch next.

); }; export const revalidate = 1; export default Random;