Micro optimization for large traces
This commit is contained in:
parent
d27df7d271
commit
3ea9dc7643
|
@ -21,20 +21,37 @@ const AddressHighlighter: React.FC<AddressHighlighterProps> = ({
|
||||||
}, [setSelection, address]);
|
}, [setSelection, address]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<AddressHighlighterImpl
|
||||||
className={`border border-dashed rounded hover:bg-transparent hover:border-transparent px-1 truncate ${
|
selected={
|
||||||
selection !== null &&
|
selection !== null &&
|
||||||
selection.type === "address" &&
|
selection.type === "address" &&
|
||||||
selection.content === address
|
selection.content === address
|
||||||
? "border-orange-400 bg-yellow-100"
|
}
|
||||||
: "border-transparent"
|
select={select}
|
||||||
|
deselect={deselect}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</AddressHighlighterImpl>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
type _AddressHighlighterImplProps = {
|
||||||
|
selected: boolean;
|
||||||
|
select: () => void;
|
||||||
|
deselect: () => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
const AddressHighlighterImpl: React.FC<_AddressHighlighterImplProps> =
|
||||||
|
React.memo(({ selected, select, deselect, children }) => (
|
||||||
|
<div
|
||||||
|
className={`border border-dashed rounded hover:bg-transparent hover:border-transparent px-1 truncate ${
|
||||||
|
selected ? "border-orange-400 bg-yellow-100" : "border-transparent"
|
||||||
}`}
|
}`}
|
||||||
onMouseEnter={select}
|
onMouseEnter={select}
|
||||||
onMouseLeave={deselect}
|
onMouseLeave={deselect}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
);
|
));
|
||||||
};
|
|
||||||
|
|
||||||
export default React.memo(AddressHighlighter);
|
export default AddressHighlighter;
|
||||||
|
|
Loading…
Reference in New Issue