feat: memoize highlighter component
This commit is contained in:
@@ -10,7 +10,7 @@ interface HighlighterProps {
|
|||||||
canvasRect: DOMRect;
|
canvasRect: DOMRect;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Highlighter = ({ unmodifiedRect, displayedSelector = '', width, height, canvasRect }: HighlighterProps) => {
|
const HighlighterComponent = ({ unmodifiedRect, displayedSelector = '', width, height, canvasRect }: HighlighterProps) => {
|
||||||
if (!unmodifiedRect) {
|
if (!unmodifiedRect) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
@@ -47,6 +47,8 @@ export const Highlighter = ({ unmodifiedRect, displayedSelector = '', width, hei
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const Highlighter = React.memo(HighlighterComponent);
|
||||||
|
|
||||||
const HighlighterOutline = styled.div<HighlighterOutlineProps>`
|
const HighlighterOutline = styled.div<HighlighterOutlineProps>`
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
pointer-events: none !important;
|
pointer-events: none !important;
|
||||||
|
|||||||
Reference in New Issue
Block a user