Skip to content

Commit bcd7141

Browse files
committed
[BLD-396] Dashboard: Fix changing tabs in /nfts/<id> page showing full page loading indicator
1 parent fe940b3 commit bcd7141

File tree

1 file changed

+21
-10
lines changed
  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]

1 file changed

+21
-10
lines changed

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/token-id.tsx

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { ExternalLinkIcon } from "lucide-react";
44
import Link from "next/link";
5-
import { useState } from "react";
5+
import { Suspense, useState } from "react";
66
import type { NFT, ThirdwebClient, ThirdwebContract } from "thirdweb";
77
import { getNFT as getErc721NFT } from "thirdweb/extensions/erc721";
88
import { getNFT as getErc1155NFT } from "thirdweb/extensions/erc1155";
@@ -89,7 +89,7 @@ export const TokenIdPage: React.FC<TokenIdPageProps> = ({
8989

9090
if (isPending) {
9191
return (
92-
<div className="flex h-[400px] items-center justify-center">
92+
<div className="flex h-[400px] items-center justify-center py-20">
9393
<Spinner className="size-10" />
9494
</div>
9595
);
@@ -179,15 +179,26 @@ export const TokenIdPage: React.FC<TokenIdPageProps> = ({
179179
<NFTDetailsTab client={contract.client} nft={nft} />
180180
)}
181181

182-
{tabs.map((tb) => {
183-
return (
184-
tb.title === tab && (
185-
<div className="w-full" key={tb.title}>
186-
{tb.children}
182+
<Suspense
183+
fallback={
184+
<div className="h-full">
185+
<div className="flex items-center gap-1.5">
186+
<Spinner className="size-4" />
187+
<p className="text-sm text-muted-foreground"> Loading </p>
187188
</div>
188-
)
189-
);
190-
})}
189+
</div>
190+
}
191+
>
192+
{tabs.map((tb) => {
193+
return (
194+
tb.title === tab && (
195+
<div className="w-full" key={tb.title}>
196+
{tb.children}
197+
</div>
198+
)
199+
);
200+
})}
201+
</Suspense>
191202
</div>
192203
</div>
193204
</div>

0 commit comments

Comments
 (0)