File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 11"use client"
22
3- import { useEffect } from "react"
3+ import { useEffect , useState } from "react"
44import Link from "next/link"
55
66export default function NotFound ( ) {
7+ const [ redirecting , setRedirecting ] = useState ( false )
8+
79 useEffect ( ( ) => {
8- // SPA fallback: if the path starts with /browse/, redirect to /browse/ with the path saved
9- // so the browse page can restore the full path-based URL
1010 const path = window . location . pathname
1111 if ( path . startsWith ( "/browse/" ) && path !== "/browse/" ) {
12+ setRedirecting ( true )
1213 sessionStorage . setItem ( "browse-redirect-path" , path + window . location . search )
1314 window . location . replace ( "/browse/" )
1415 }
1516 } , [ ] )
1617
18+ if ( redirecting ) return null
19+
1720 return (
1821 < div className = "flex min-h-[60vh] flex-col items-center justify-center px-4" >
1922 < h1 className = "mb-2 text-6xl font-bold text-stone-300 dark:text-stone-700" > 404</ h1 >
You can’t perform that action at this time.
0 commit comments