浏览代码

fix: add verification for path /404 (#3723)

Co-authored-by: coolstorm <manas.gupta@fampay.in>
Manas Gupta 9 月之前
父节点
当前提交
c7e30522bc
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      reflex/.templates/web/utils/client_side_routing.js

+ 6 - 1
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
       })