@@ -5,6 +5,7 @@ import { cn } from "@call/ui/lib/utils";
55import { motion , MotionConfig , type Transition } from "motion/react" ;
66import { useState , useEffect , useRef , use } from "react" ;
77import { useUnauthenticatedMeeting } from "@/hooks/use-unauthenticated-meeting" ;
8+ import { useSearchParams } from "next/navigation" ;
89
910const tabs = [ "Join" , "Start" ] as const ;
1011
@@ -22,11 +23,8 @@ const formVariants = {
2223 exit : { opacity : 0 , y : 20 } ,
2324} ;
2425
25- interface MeetingFormProps {
26- searchParams : Promise < { meetingId ?: string } > ;
27- }
28-
29- function MeetingFormClient ( { searchParams } : MeetingFormProps ) {
26+ function MeetingFormClient ( ) {
27+ const searchParams = useSearchParams ( ) ;
3028 const [ activeTab , setActiveTab ] = useState < ( typeof tabs ) [ number ] > ( "Join" ) ;
3129 const hasSetMeetingId = useRef ( false ) ;
3230 const {
@@ -39,21 +37,13 @@ function MeetingFormClient({ searchParams }: MeetingFormProps) {
3937 clearErrors,
4038 } = useUnauthenticatedMeeting ( ) ;
4139
42- // Use React's 'use' hook to unwrap the Promise-based searchParams
43- const resolvedSearchParams = use ( searchParams ) ;
44-
4540 useEffect ( ( ) => {
4641 if ( ! hasSetMeetingId . current ) {
4742 setActiveTab ( "Join" ) ;
48- updateFormData ( "meetingId" , resolvedSearchParams . meetingId || "" ) ;
43+ updateFormData ( "meetingId" , searchParams . get ( " meetingId" ) || "" ) ;
4944 hasSetMeetingId . current = true ;
5045 }
51- } , [ resolvedSearchParams . meetingId , updateFormData ] ) ;
52-
53- // Debug: Log form data changes
54- useEffect ( ( ) => {
55- console . log ( "Form data changed:" , formData ) ;
56- } , [ formData ] ) ;
46+ } , [ searchParams . get ( "meetingId" ) , updateFormData ] ) ;
5747
5848 const handleTabChange = ( tab : ( typeof tabs ) [ number ] ) => {
5949 setActiveTab ( tab ) ;
@@ -186,10 +176,6 @@ function MeetingFormClient({ searchParams }: MeetingFormProps) {
186176 ) ;
187177}
188178
189- export default function MeetingForm ( {
190- searchParams,
191- } : {
192- searchParams : Promise < { meetingId ?: string } > ;
193- } ) {
194- return < MeetingFormClient searchParams = { searchParams } /> ;
179+ export default function MeetingForm ( ) {
180+ return < MeetingFormClient /> ;
195181}
0 commit comments