Possible small optimization for name-text

This commit is contained in:
Lim Chee Aun 2023-09-09 14:25:53 +08:00
parent 8018d06cdf
commit fea1d77342

View file

@ -1,5 +1,7 @@
import './name-text.css'; import './name-text.css';
import { memo } from 'preact/compat';
import states from '../utils/states'; import states from '../utils/states';
import Avatar from './avatar'; import Avatar from './avatar';
@ -43,6 +45,7 @@ function NameText({
onClick={(e) => { onClick={(e) => {
if (external) return; if (external) return;
e.preventDefault(); e.preventDefault();
e.stopPropagation();
if (onClick) return onClick(e); if (onClick) return onClick(e);
states.showAccount = { states.showAccount = {
account, account,
@ -85,4 +88,4 @@ function NameText({
); );
} }
export default NameText; export default memo(NameText);