diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 00000000..8cb7b995 Binary files /dev/null and b/public/favicon.ico differ diff --git a/src/app/[chain]/block/[hash]/page.tsx b/src/app/[chain]/block/[hash]/page.tsx index e7d26702..275eee35 100644 --- a/src/app/[chain]/block/[hash]/page.tsx +++ b/src/app/[chain]/block/[hash]/page.tsx @@ -17,3 +17,6 @@ export default async function Block({ params }: { params: { hash: string; chain: console.log(data, 'data'); return ; } + +export const revalidate = 1; +export const dynamic = 'force-dynamic'; diff --git a/src/app/[chain]/blocks/blockList.tsx b/src/app/[chain]/blocks/blockList.tsx index b59139b8..4aad7db6 100644 --- a/src/app/[chain]/blocks/blockList.tsx +++ b/src/app/[chain]/blocks/blockList.tsx @@ -41,6 +41,7 @@ export default function BlockList({ SSRData }) { const [data, setData] = useState(SSRData.blocks); const { defaultChain } = useAppSelector((state) => state.getChainId); const totalPage = Math.floor((total + pageSize - 1) / pageSize) || 1; + const { chain } = useParams(); const fetchData = useCallback( async (pageSize, type: pageType) => { let blockHeight; @@ -71,7 +72,6 @@ export default function BlockList({ SSRData }) { [currentPage, data, defaultChain, totalPage], ); - const { chain } = useParams(); const [timeFormat, setTimeFormat] = useState('Age'); const columns = useMemo>(() => { return getColumns({ diff --git a/src/app/[chain]/layout.tsx b/src/app/[chain]/layout.tsx new file mode 100644 index 00000000..1ad5b9a4 --- /dev/null +++ b/src/app/[chain]/layout.tsx @@ -0,0 +1,3 @@ +export default function Layout({ children }) { + return
{children}
; +} diff --git a/src/app/[chain]/loading.tsx b/src/app/[chain]/loading.tsx new file mode 100644 index 00000000..2b09afda --- /dev/null +++ b/src/app/[chain]/loading.tsx @@ -0,0 +1,7 @@ +'use client'; +import { useIsGovernance } from '@_hooks/useIsPath'; +import { Skeleton } from 'antd'; +export default function Loading() { + const isGovernance = useIsGovernance(); + return !isGovernance && ; +} diff --git a/src/app/[chain]/token/[tokenSymbol]/page.tsx b/src/app/[chain]/token/[tokenSymbol]/page.tsx index fdd5e76d..ac76bb61 100644 --- a/src/app/[chain]/token/[tokenSymbol]/page.tsx +++ b/src/app/[chain]/token/[tokenSymbol]/page.tsx @@ -25,3 +25,6 @@ export default async function TokenSymbol({ ); } + +export const revalidate = 1; +export const dynamic = 'force-dynamic'; diff --git a/src/app/[chain]/tokens/page.tsx b/src/app/[chain]/tokens/page.tsx index aac42861..15601cca 100644 --- a/src/app/[chain]/tokens/page.tsx +++ b/src/app/[chain]/tokens/page.tsx @@ -22,3 +22,6 @@ export default async function TokensPage({ params }: { params: ChainId }) { }); return ; } + +export const revalidate = 1; +export const dynamic = 'force-dynamic'; diff --git a/src/app/api/revalidate/route.ts b/src/app/api/revalidate/route.ts new file mode 100644 index 00000000..f459aa59 --- /dev/null +++ b/src/app/api/revalidate/route.ts @@ -0,0 +1,8 @@ +import { NextRequest } from 'next/server'; +import { revalidateTag } from 'next/cache'; + +export async function GET(request: NextRequest) { + const tag = request.nextUrl.searchParams.get('tag'); + revalidateTag(tag || ''); + return Response.json({ revalidated: true, now: Date.now() }); +} diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 878c7957..3e029540 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -21,10 +21,11 @@ import StyleRegistry from './StyleRegistry'; import { fetchCMS } from '@_api/fetchCMS'; import { PublicEnvProvider } from 'next-runtime-env'; import type { Viewport } from 'next'; +import { revalidatePath } from 'next/cache'; export const metadata: Metadata = { - title: 'Create Next App', - description: 'Generated by create next app', + title: 'AELF Block Explorer', + description: 'AELF explorer', }; async function fetchData() { await new Promise((resolve) => setTimeout(resolve, 1000)); @@ -37,6 +38,7 @@ async function fetchData() { } export default async function RootLayout({ children }: { children: React.ReactNode }) { + revalidatePath('/', 'layout'); const data = await fetchData(); const { price, previousPrice } = data; const headersList = headers(); @@ -44,6 +46,9 @@ export default async function RootLayout({ children }: { children: React.ReactNo const { headerMenuList, footerMenuList, chainList, networkList } = await fetchCMS(); return ( + + +