Skip to content

Commit

Permalink
🔊 Log everything
Browse files Browse the repository at this point in the history
  • Loading branch information
fredk3 committed Mar 22, 2024
1 parent 7f333e6 commit 4904bdd
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
39 changes: 39 additions & 0 deletions apps/web/app/(home)/[network]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,33 @@ interface Props {
}

export async function generateMetadata(props: Props): Promise<Metadata> {
console.log(
`==================[generateMetadata (/${props.params.network})]==================`,
);
const network = await getSingleNetwork(props.params.network);
console.dir(
{
network,
},
{ depth: null },
);
if (!network) notFound();

console.log({
title: `${capitalize(network.brand)}`,
description: `A block explorer for the ${capitalize(network.brand)} ecosystem.`,
openGraph: {
url: `/${network.slug}`,
type: "website",
images: [
{
url: `${env.NEXT_PUBLIC_PRODUCTION_URL}/api/og?model=network-home&networkSlug=${network.slug}`,
...OG_SIZE,
},
],
},
});

return {
title: `${capitalize(network.brand)}`,
description: `A block explorer for the ${capitalize(network.brand)} ecosystem.`,
Expand All @@ -38,12 +62,27 @@ export async function generateMetadata(props: Props): Promise<Metadata> {
}

export default async function NetworkWidgetPage({ params }: Props) {
console.log(
`==================[PAGE (/${params.network})]==================`,
);
const network = await getSingleNetwork(params.network);

console.dir(
{
network,
},
{ depth: null },
);
// this fixes a bug on vercel with build where it would throw if the network doesn't
// exist (even though technically it should always exist)
if (!network) notFound();

console.dir(
{
layout: network.config.widgetLayout,
},
{ depth: null },
);
switch (network.config.widgetLayout) {
case "SVM":
return (
Expand Down
1 change: 0 additions & 1 deletion apps/web/lib/headless-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,6 @@ export async function checkIfNetworkIsOnline(
}
try {
const { result } = await jsonFetch(`${rpcUrl}/status`, {
cache: "force-cache",
next: {
tags: CACHE_KEYS.networks.status(network),
revalidate: ONE_MINUTE,
Expand Down
6 changes: 6 additions & 0 deletions apps/web/lib/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ async function getSingleNetworkFetch(slug: string) {
integration.config.primaryColor = "29 13% 45%";
}

console.dir(
{
integration,
},
{ depth: null },
);
return integration;
} catch (error) {
return null;
Expand Down

0 comments on commit 4904bdd

Please sign in to comment.