Skip to content

Commit 8ef2fe9

Browse files
committed
feat: removed the router to window.href for new information
1 parent 2e9aa33 commit 8ef2fe9

File tree

2 files changed

+8
-23
lines changed

2 files changed

+8
-23
lines changed

apps/web/app/r/page.tsx

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { cn } from "@call/ui/lib/utils";
55
import { motion, MotionConfig, type Transition } from "motion/react";
66
import { useState, useEffect, useRef, use } from "react";
77
import { useUnauthenticatedMeeting } from "@/hooks/use-unauthenticated-meeting";
8+
import { useSearchParams } from "next/navigation";
89

910
const 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
}

apps/web/hooks/use-unauthenticated-meeting.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,7 @@ export const useUnauthenticatedMeeting =
131131
},
132132
onSuccess: (data: { call: Call }) => {
133133
toast.success("Joined call successfully!");
134-
router.refresh();
135-
router.push(`/r/${data.call.id}`);
134+
window.location.href = `/r/${data.call.id}`;
136135
resetForm();
137136
},
138137
onError: (error) => {

0 commit comments

Comments
 (0)