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,7 +84,30 @@ const TraceItem: React.FC<TraceItemProps> = ({
expanded ? "" : "hidden" expanded ? "" : "hidden"
}`} }`}
> >
{t.children.map((tc, i, a) => ( <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 <TraceItem
key={i} key={i}
t={tc} t={tc}
@ -94,10 +117,9 @@ const TraceItem: React.FC<TraceItemProps> = ({
resolvedAddresses={resolvedAddresses} resolvedAddresses={resolvedAddresses}
/> />
))} ))}
</div>
)}
</> </>
); );
}; }
);
export default TraceItem; export default TraceItem;