fix: pinned message hidden sometimes

This commit is contained in:
Tristan Yang
2022-12-29 20:46:55 +08:00
parent 3e40e2f496
commit 1ef9cef69c
7 changed files with 106 additions and 37 deletions
@@ -14,8 +14,8 @@ const PreviewMessage: FC<Props> = ({ mid = 0 }) => {
return { msg: store.message[mid], usersData: store.users.byId };
});
if (!msg) return null;
const { from_uid, created_at, content_type, content, thumbnail = "", properties } = msg;
const { name, avatar } = usersData[from_uid || 0] || {};
const { from_uid = 0, created_at, content_type, content, thumbnail = "", properties } = msg;
const { name, avatar } = usersData[from_uid] ?? {};
return (
<StyledWrapper className={`preview`}>
<div className="avatar">