Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Resolve an issue with next.js caching user profiles to a 404 #680

Merged
merged 2 commits into from
Jan 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions apps/next-react/src/pages/[profile].js
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,11 @@ export async function getStaticProps({ params: { profile: slug_address } }) {
revalidate: 2,
};
} catch (err) {
if (err.response.status == 400)
if (err.response.status == 400) {
return { redirect: { destination: "/", permanent: false } };
else return { notFound: true };
} else {
return { notFound: true, revalidate: 1 };
}
}
}

Expand Down