Skip to content

Commit 99e5bce

Browse files
fix: fixing the redirection to /docs
Refactor NotFound component to use window.location.replace for immediate redirect. Signed-off-by: Karan Suresh <[email protected]>
1 parent ff9d3e0 commit 99e5bce

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed
Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
1-
import React, {useEffect} from "react";
2-
import {PageMetadata} from "@docusaurus/theme-common";
1+
import { useEffect } from "react";
32

4-
export default function Index() {
3+
export default function NotFound() {
54
useEffect(() => {
6-
window.location.href = "/docs/";
7-
}, 2000);
8-
[];
5+
if (typeof window !== "undefined") {
6+
// immediate redirect without adding to browser history
7+
window.location.replace("/docs");
8+
}
9+
}, []);
910

10-
return (
11-
<>
12-
<PageMetadata title="Redirecting..." />
13-
<main className="margin-vert--xl container">
14-
<div className="row">
15-
<div className="col col--6 col--offset-3">
16-
<h1 className="hero__title">Redirecting to home page...</h1>
17-
</div>
18-
</div>
19-
</main>
20-
</>
21-
);
11+
// render nothing (no content shown)
12+
return null;
2213
}

0 commit comments

Comments
 (0)