Skip to content

Commit 09b7404

Browse files
committed
Show 404 on deprecated chain contract page (#5139)
## Problem solved Short description of the bug fixed or feature added <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on improving the handling of contract metadata and checking for deprecated chains in the `layout.tsx` file. It ensures that the correct contract information is used and adds a condition to handle deprecated chain statuses. ### Detailed summary - Added a check for `chainMetadata.status` to call `notFound()` if the status is "deprecated". - Updated the `isValidContract` check to use `contract` from `info` instead of the previous variable. - Rearranged the destructuring of `contract` and `chainMetadata` for clarity. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent 3c77c6b commit 09b7404

File tree

1 file changed

+7
-2
lines changed
  • apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]

1 file changed

+7
-2
lines changed

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/layout.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,19 @@ export default async function Layout(props: {
2828
return <ConfigureCustomChain chainSlug={props.params.chain_id} />;
2929
}
3030

31+
const { contract, chainMetadata } = info;
32+
33+
if (chainMetadata.status === "deprecated") {
34+
notFound();
35+
}
36+
3137
// check if the contract exists
32-
const isValidContract = await isContractDeployed(info.contract);
38+
const isValidContract = await isContractDeployed(contract);
3339
if (!isValidContract) {
3440
// TODO - replace 404 with a better page to upsale deploy or other thirdweb products
3541
notFound();
3642
}
3743

38-
const { contract, chainMetadata } = info;
3944
const contractPageMetadata = await getContractPageMetadata(contract);
4045
const sidebarLinks = getContractPageSidebarLinks({
4146
chainSlug: chainMetadata.slug,

0 commit comments

Comments
 (0)