From 6de2a1c9fabe2ba6b5a435d1a08d465a70bbe752 Mon Sep 17 00:00:00 2001 From: Gabriel Kaszewski Date: Tue, 31 Mar 2026 02:34:02 +0200 Subject: [PATCH] fix: fall back to home when no history in GoBackButton --- components/go-back-button.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/components/go-back-button.tsx b/components/go-back-button.tsx index 224d7b1..3cb2b1e 100644 --- a/components/go-back-button.tsx +++ b/components/go-back-button.tsx @@ -4,9 +4,19 @@ import { useRouter } from "next/navigation"; export default function GoBackButton() { const router = useRouter(); + + const handleBack = () => { + if (window.history.length > 1) { + router.back(); + } else { + router.push("/"); + } + }; + return (