From c7e30522bc224e960487d2084e45f0d273109357 Mon Sep 17 00:00:00 2001 From: Manas Gupta <53006261+Manas1820@users.noreply.github.com> Date: Tue, 6 Aug 2024 02:32:47 +0530 Subject: [PATCH] fix: add verification for path /404 (#3723) Co-authored-by: coolstorm --- reflex/.templates/web/utils/client_side_routing.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/reflex/.templates/web/utils/client_side_routing.js b/reflex/.templates/web/utils/client_side_routing.js index 75fb581c8e..1718c8e61e 100644 --- a/reflex/.templates/web/utils/client_side_routing.js +++ b/reflex/.templates/web/utils/client_side_routing.js @@ -23,7 +23,12 @@ export const useClientSideRouting = () => { router.replace({ pathname: window.location.pathname, query: window.location.search.slice(1), - }) + }).then(()=>{ + // Check if the current route is /404 + if (router.pathname === '/404') { + setRouteNotFound(true); // Mark as an actual 404 + } + }) .catch((e) => { setRouteNotFound(true) // navigation failed, so this is a real 404 })