From a57f3439f801c1d41256a8a46bd319c17dff86f1 Mon Sep 17 00:00:00 2001 From: Nihaal Sangha Date: Mon, 15 May 2023 03:17:29 +0100 Subject: [PATCH] fix: replace history entries when searching (#62) --- src/components/Search.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Search.tsx b/src/components/Search.tsx index ed61ea8..39c96ef 100644 --- a/src/components/Search.tsx +++ b/src/components/Search.tsx @@ -63,9 +63,9 @@ export default function SearchBar({ searchList }: Props) { searchParams.set("q", inputVal); const newRelativePathQuery = window.location.pathname + "?" + searchParams.toString(); - history.pushState(null, "", newRelativePathQuery); + history.replaceState(null, "", newRelativePathQuery); } else { - history.pushState(null, "", window.location.pathname); + history.replaceState(null, "", window.location.pathname); } }, [inputVal]);