Commit b9b8ee0d authored by tom's avatar tom

change ovserver for addresses

parent 9b410245
...@@ -78,10 +78,12 @@ const AddressWithDots = ({ address, fontWeight, truncated }: Props) => { ...@@ -78,10 +78,12 @@ const AddressWithDots = ({ address, fontWeight, truncated }: Props) => {
useEffect(() => { useEffect(() => {
if (!truncated) { if (!truncated) {
const resizeHandler = _debounce(calculateString, 50); const resizeHandler = _debounce(calculateString, 100);
window.addEventListener('resize', resizeHandler); const resizeObserver = new ResizeObserver(resizeHandler);
resizeObserver.observe(document.body);
return function cleanup() { return function cleanup() {
window.removeEventListener('resize', resizeHandler); resizeObserver.unobserve(document.body);
}; };
} }
}, [ calculateString, truncated ]); }, [ calculateString, truncated ]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment