Skip to content

Commit e246d14

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

File tree

1 file changed

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

1 file changed

+19
-11
lines changed

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

Lines changed: 19 additions & 11 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,23 @@ 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}
187-
</div>
188-
)
189-
);
190-
})}
182+
<Suspense
183+
fallback={
184+
<div className="h-full min-h-[500px] flex items-center justify-center">
185+
<Spinner className="size-10" />{" "}
186+
</div>
187+
}
188+
>
189+
{tabs.map((tb) => {
190+
return (
191+
tb.title === tab && (
192+
<div className="w-full" key={tb.title}>
193+
{tb.children}
194+
</div>
195+
)
196+
);
197+
})}
198+
</Suspense>
191199
</div>
192200
</div>
193201
</div>

0 commit comments

Comments
 (0)