From 24e05e06e9eaf195f21b9895f3994d2e7e014fbc Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Sun, 24 Oct 2021 01:04:18 -0300 Subject: [PATCH] Lazy import tabs --- src/Transaction.tsx | 50 +++++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/src/Transaction.tsx b/src/Transaction.tsx index 0edd994..a240c7e 100644 --- a/src/Transaction.tsx +++ b/src/Transaction.tsx @@ -5,8 +5,6 @@ import StandardFrame from "./StandardFrame"; import StandardSubtitle from "./StandardSubtitle"; import ContentFrame from "./ContentFrame"; import NavTab from "./components/NavTab"; -import Details from "./transaction/Details"; -import Logs from "./transaction/Logs"; import { RuntimeContext } from "./useRuntime"; import { SelectionContext, useSelection } from "./useSelection"; import { useInternalOperations, useTxData } from "./useErigonHooks"; @@ -14,6 +12,20 @@ import { useETHUSDOracle } from "./usePriceOracle"; import { useAppConfigContext } from "./useAppConfig"; import { useSourcify, useTransactionDescription } from "./useSourcify"; +const Details = React.lazy( + () => + import( + /* webpackChunkName: "txdetails", webpackPrefetch: true */ + "./transaction/Details" + ) +); +const Logs = React.lazy( + () => + import( + /* webpackChunkName: "txlogs", webpackPrefetch: true */ "./transaction/Logs" + ) +); + type TransactionParams = { txhash: string; }; @@ -77,22 +89,24 @@ const Transaction: React.FC = () => { )} - - -
- - - - - + + + +
+ + + + + + )}