Skip to content

Commit 1fb4ebb

Browse files
fix: reslove routing b/w content pages
1 parent 7e0b0cf commit 1fb4ebb

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/components/Page/Page.jsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ export default function Page(props) {
4242
.catch(() => setContent("Error loading content."));
4343
}
4444
}, [props.content]);
45+
useEffect(() => {
46+
if (!(props.content instanceof Promise)) {
47+
// eslint-disable-next-line react-hooks/set-state-in-effect
48+
setContent(() => props.content.default || props.content);
49+
setContentLoaded(true);
50+
}
51+
}, [props.content]);
4552

4653
const { hash, pathname } = useLocation();
4754
const isBlogIndex = pathname === "/blog/";

0 commit comments

Comments
 (0)