diff --git a/app/address/[address]/layout.tsx b/app/address/[address]/layout.tsx index 8d212a91..e27cd137 100644 --- a/app/address/[address]/layout.tsx +++ b/app/address/[address]/layout.tsx @@ -34,7 +34,7 @@ import { useAnchorProgram } from '@providers/anchor'; import { CacheEntry, FetchStatus } from '@providers/cache'; import { useCluster } from '@providers/cluster'; import { PROGRAM_ID as ACCOUNT_COMPRESSION_ID } from '@solana/spl-account-compression'; -import { PublicKey } from '@solana/web3.js'; +import { Ed25519Program, PublicKey } from '@solana/web3.js'; import { Cluster, ClusterStatus } from '@utils/cluster'; import { FEATURE_PROGRAM_ID } from '@utils/parseFeatureAccount'; import { useClusterPath } from '@utils/url'; @@ -364,10 +364,10 @@ function Token22MintHeader({ }) { const tokenMetadata = create(metadataExtension.state, TokenMetadata); const { metadataAddress } = create(metadataPointerExtension.state, MetadataPointer); - const metadata = useMetadataJsonLink(tokenMetadata.uri); + const metadata = useMetadataJsonLink(tokenMetadata.uri, { suspense: true }); if (!metadata) { - throw new Error('Could not load metadata from given URI'); + throw new Error(`Could not load metadata from given URI: ${tokenMetadata.uri}`); } // Handles the basic case where MetadataPointer is referencing the Token Metadata extension directly diff --git a/app/providers/compressed-nft.tsx b/app/providers/compressed-nft.tsx index d118daa8..feb45e4f 100644 --- a/app/providers/compressed-nft.tsx +++ b/app/providers/compressed-nft.tsx @@ -1,9 +1,13 @@ import useSWRImmutable from 'swr/immutable'; -export function useMetadataJsonLink(url: string) { - const { data, error } = useSWRImmutable(url, async (url: string) => { - return fetch(url).then(response => response.json()); - }); +export function useMetadataJsonLink(url: string, options?: { suspense?: boolean }) { + const { data, error } = useSWRImmutable( + url, + async (url: string) => { + return fetch(url).then(response => response.json()); + }, + { suspense: options?.suspense } + ); return error ? null : data; }