Merge pull request #1166 from SohamBhattacharjee2003/fix/remove-unnecessary-use-client-directives

fix: remove unnecessary use client directives
This commit is contained in:
Rohan Verma 2026-04-07 23:36:33 -07:00 committed by GitHub
commit cf2115bc90
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 26 additions and 57 deletions

View file

@ -2,6 +2,7 @@
import { BadgeCheck, LogOut } from "lucide-react";
import Link from "next/link";
import { useRouter } from "next/navigation";
import { useState } from "react";
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
import { Button } from "@/components/ui/button";
@ -27,6 +28,7 @@ export function UserDropdown({
avatar: string;
};
}) {
const router = useRouter();
const [isLoggingOut, setIsLoggingOut] = useState(false);
const handleLogout = async () => {
@ -38,12 +40,16 @@ export function UserDropdown({
await logout();
router.push("/");
router.refresh();
if (typeof window !== "undefined") {
window.location.href = getLoginPath();
}
} catch (error) {
console.error("Error during logout:", error);
await logout();
router.push("/");
router.refresh();
if (typeof window !== "undefined") {
window.location.href = getLoginPath();
}

View file

@ -1,5 +1,3 @@
"use client";
/**
* Maps SearchSourceConnectorType to DocumentType for fetching document counts
*

View file

@ -2,6 +2,7 @@
import { zodResolver } from "@hookform/resolvers/zod";
import { useAtomValue } from "jotai";
import { useRouter } from "next/navigation";
import { useTranslations } from "next-intl";
import { useState } from "react";
import { useForm } from "react-hook-form";
@ -43,6 +44,7 @@ interface CreateSearchSpaceDialogProps {
export function CreateSearchSpaceDialog({ open, onOpenChange }: CreateSearchSpaceDialogProps) {
const t = useTranslations("searchSpace");
const tCommon = useTranslations("common");
const router = useRouter();
const [isSubmitting, setIsSubmitting] = useState(false);
const { mutateAsync: createSearchSpace } = useAtomValue(createSearchSpaceMutationAtom);
@ -65,8 +67,7 @@ export function CreateSearchSpaceDialog({ open, onOpenChange }: CreateSearchSpac
trackSearchSpaceCreated(result.id, values.name);
// Hard redirect to ensure fresh state
window.location.href = `/dashboard/${result.id}/onboard`;
router.push(`/dashboard/${result.id}/onboard`);
} catch (error) {
console.error("Failed to create search space:", error);
setIsSubmitting(false);