Reduce redraws

This commit is contained in:
Willian Mitsuda 2021-11-03 04:52:01 -03:00
parent 596ed93e0e
commit 3b60030817

View File

@ -84,20 +84,42 @@ const TraceItem: React.FC<TraceItemProps> = ({
expanded ? "" : "hidden"
}`}
>
{t.children.map((tc, i, a) => (
<TraceItem
key={i}
t={tc}
txData={txData}
last={i === a.length - 1}
fourBytesMap={fourBytesMap}
resolvedAddresses={resolvedAddresses}
/>
))}
<TraceChildren
c={t.children}
txData={txData}
fourBytesMap={fourBytesMap}
resolvedAddresses={resolvedAddresses}
/>
</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;