diff --git a/surfsense_web/components/UserDropdown.tsx b/surfsense_web/components/UserDropdown.tsx index 53fd61b20..0ffb172bf 100644 --- a/surfsense_web/components/UserDropdown.tsx +++ b/surfsense_web/components/UserDropdown.tsx @@ -40,19 +40,13 @@ export function UserDropdown({ await logout(); - router.push("/"); + router.push(getLoginPath()); router.refresh(); - if (typeof window !== "undefined") { - window.location.href = getLoginPath(); - } } catch (error) { console.error("Error during logout:", error); await logout(); - router.push("/"); + router.push(getLoginPath()); router.refresh(); - if (typeof window !== "undefined") { - window.location.href = getLoginPath(); - } } }; diff --git a/surfsense_web/components/layout/ui/tabs/DocumentTabContent.tsx b/surfsense_web/components/layout/ui/tabs/DocumentTabContent.tsx index 97c5b7cd9..026f3afc3 100644 --- a/surfsense_web/components/layout/ui/tabs/DocumentTabContent.tsx +++ b/surfsense_web/components/layout/ui/tabs/DocumentTabContent.tsx @@ -1,6 +1,7 @@ "use client"; import { Download, FileQuestionMark, FileText, Loader2, PenLine, RefreshCw } from "lucide-react"; +import { useRouter } from "next/navigation"; import { useCallback, useEffect, useRef, useState } from "react"; import { toast } from "sonner"; import { PlateEditor } from "@/components/editor/plate-editor"; @@ -60,6 +61,7 @@ export function DocumentTabContent({ documentId, searchSpaceId, title }: Documen const markdownRef = useRef(""); const initialLoadDone = useRef(false); const changeCountRef = useRef(0); + const router = useRouter(); const isLargeDocument = (doc?.content_size_bytes ?? 0) > LARGE_DOCUMENT_THRESHOLD; @@ -190,7 +192,7 @@ export function DocumentTabContent({ documentId, searchSpaceId, title }: Documen variant="outline" size="sm" className="mt-1 gap-1.5" - onClick={() => window.location.reload()} + onClick={() => router.refresh()} > Retry