Possible small optimization for name-text
This commit is contained in:
parent
8018d06cdf
commit
fea1d77342
1 changed files with 4 additions and 1 deletions
|
@ -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);
|
||||||
|
|
Loading…
Add table
Reference in a new issue