Reduce redraws

This commit is contained in:
Willian Mitsuda 2021-11-03 04:52:01 -03:00
parent 596ed93e0e
commit 3b60030817
1 changed files with 32 additions and 10 deletions

View File

@ -84,20 +84,42 @@ const TraceItem: React.FC<TraceItemProps> = ({
expanded ? "" : "hidden" expanded ? "" : "hidden"
}`} }`}
> >
{t.children.map((tc, i, a) => ( <TraceChildren
<TraceItem c={t.children}
key={i} txData={txData}
t={tc} fourBytesMap={fourBytesMap}
txData={txData} resolvedAddresses={resolvedAddresses}
last={i === a.length - 1} />
fourBytesMap={fourBytesMap}
resolvedAddresses={resolvedAddresses}
/>
))}
</div> </div>
)} )}
</> </>
); );
}; };
type TraceChildrenProps = {
c: TraceGroup[];
txData: TransactionData;
fourBytesMap: Record<string, FourBytesEntry | null | undefined>;
resolvedAddresses: ResolvedAddresses | undefined;
};
const TraceChildren: React.FC<TraceChildrenProps> = React.memo(
({ c, txData, fourBytesMap, resolvedAddresses }) => {
return (
<>
{c.map((tc, i, a) => (
<TraceItem
key={i}
t={tc}
txData={txData}
last={i === a.length - 1}
fourBytesMap={fourBytesMap}
resolvedAddresses={resolvedAddresses}
/>
))}
</>
);
}
);
export default TraceItem; export default TraceItem;