From edf3aad8c497e3f2b64b69a6b9e79225763da444 Mon Sep 17 00:00:00 2001 From: MananTank Date: Thu, 9 Oct 2025 22:14:05 +0000 Subject: [PATCH] [BLD-396] Dashboard: Fix changing tabs in /nfts/ page shows full page loading indicator (#8224) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ## PR-Codex overview This PR enhances the `TokenIdPage` component by introducing `Suspense` for improved loading state handling and adjusting the layout of the loading spinner. ### Detailed summary - Added `Suspense` for handling loading states. - Updated the loading spinner layout with additional padding (`py-20`). - Wrapped the tab rendering logic within the `Suspense` component for better user experience during data fetching. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` ## Summary by CodeRabbit - New Features - Introduced a loading experience for NFT tab content using Suspense, providing a fallback UI while content loads. - Improves responsiveness when switching tabs by deferring heavy content until ready. - Style - Increased vertical padding for the pending NFT state to enhance visual spacing and readability. --- .../nfts/[tokenId]/token-id.tsx | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/token-id.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/token-id.tsx index 8df477ed414..34b21349f7f 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/token-id.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/token-id.tsx @@ -2,7 +2,7 @@ import { ExternalLinkIcon } from "lucide-react"; import Link from "next/link"; -import { useState } from "react"; +import { Suspense, useState } from "react"; import type { NFT, ThirdwebClient, ThirdwebContract } from "thirdweb"; import { getNFT as getErc721NFT } from "thirdweb/extensions/erc721"; import { getNFT as getErc1155NFT } from "thirdweb/extensions/erc1155"; @@ -89,7 +89,7 @@ export const TokenIdPage: React.FC = ({ if (isPending) { return ( -
+
); @@ -179,15 +179,26 @@ export const TokenIdPage: React.FC = ({ )} - {tabs.map((tb) => { - return ( - tb.title === tab && ( -
- {tb.children} + +
+ +

Loading

- ) - ); - })} +
+ } + > + {tabs.map((tb) => { + return ( + tb.title === tab && ( +
+ {tb.children} +
+ ) + ); + })} +