refactor: useSelector

This commit is contained in:
Tristan Yang
2023-08-29 11:33:23 +08:00
parent 647bae7116
commit fe10a1c374
116 changed files with 572 additions and 661 deletions
+2 -5
View File
@@ -12,6 +12,7 @@ import IconMessage from "@/assets/icons/message.svg";
import IconMore from "@/assets/icons/more.svg";
import Avatar from "../Avatar";
import ContextMenu, { Item } from "../ContextMenu";
import { shallowEqual } from "react-redux";
interface Props {
uid: number;
@@ -36,11 +37,7 @@ const Profile: FC<Props> = ({ uid, type = "embed", cid }) => {
updateRole
} = useUserOperation({ uid, cid });
const { data } = useAppSelector((store) => {
return {
data: store.users.byId[uid]
};
});
const data = useAppSelector((store) => store.users.byId[uid], shallowEqual);
if (!data) return null;
// console.log("profile", data);
const {