So basically every time a navigate to a different page in this case from home page to /blog using next-link I get Unhandled Runtime Error
TypeError: destroy is not a function
but when I refresh the page the page loads correctly or if I type in the URL manually in the browser for instance localhost:3000/blog
here is a screenshot of the error
and here is the code for the blog page
///blog page
export default function Blog(props) {
const { posts, tags } = props;
function switchMode() {
props.setMode(props.mode === 'light' ? 'dark' : 'light');
}
return (
<>
<Head>
<title>Blog</title>
<link rel="icon" href="/favicon.ico" />
<meta name="description" content="Yushae Raza's personal blog" />
</Head>
<main style={{ paddingTop: "5em" }}>
<Container>
<Typography variant="h1" align="center" >
Blog
</Typography>
<Divider />
<br></br>
<Grid container spacing={2}>
<Grid item xs={12} md={8}>
{posts.map((post, idx) => (<>
<Post
title={post.title}
publishedAt={post.published_at}
author={post.authors[0].name}
imageUrl={post.feature_image}
description={post.excerpt}
category={post.tags[0].name}
slug={post.slug} /><br></br>
</>)
)}
</Grid>
<Grid item xs={12} md={4}>
<Sidebar tags={tags} />
</Grid>
</Grid>
</Container>
</main>
</>
)
}
export async function getStaticProps() {
// get posts from our api
const { posts } = await api.getPosts(0);
const { tags } = await api.getTags();
// console.log(posts)
return {
props: { posts, tags },
revalidate: 10
};
}
//navbar
const pages = [
{ name: 'Blog', link: '/blog' },
]
{pages.map((page, idx) => (
<MenuItem key={idx} onClick={handleCloseNavMenu}
sx={{ flexGrow: 1 }}>
<Link href={page.link}>
{page.name}
</Link>
</MenuItem>
))}

