diff --git a/client/src/page/friends.tsx b/client/src/page/friends.tsx index 2cc10f6c..aace0aba 100644 --- a/client/src/page/friends.tsx +++ b/client/src/page/friends.tsx @@ -1,5 +1,5 @@ import i18next from "i18next"; -import { useCallback, useContext, useEffect, useRef, useState } from "react"; +import { useCallback, useContext, useEffect, useMemo, useRef, useState } from "react"; import { Helmet } from 'react-helmet'; import { useTranslation } from "react-i18next"; import Modal from 'react-modal'; @@ -86,9 +86,6 @@ export function FriendsPage() { }) ref.current = true }, []) - function publishButton() { - publish({ name, desc, avatar, url, showAlert }) - } return (<> {`${t('friends.title')} - ${process.env.NAME}`} @@ -117,7 +114,7 @@ export function FriendsPage() {
- +
@@ -130,7 +127,7 @@ export function FriendsPage() { } function FriendList({ title, show, friends }: { title: string, show: boolean, friends: FriendItem[] }) { - return (<> + return useMemo(() => <> { show && <>
@@ -145,7 +142,7 @@ function FriendList({ title, show, friends }: { title: string, show: boolean, fr
} - ) + , [title, show, friends]) } function Friend({ friend }: { friend: FriendItem }) { @@ -199,11 +196,11 @@ function Friend({ friend }: { friend: FriendItem }) { }) }, [avatar, name, desc, url, status]) - const statusOption = [ + const statusOption = useMemo(()=>[ { value: -1, label: t('friends.review.rejected') }, { value: 0, label: t('friends.review.waiting') }, { value: 1, label: t('friends.review.accepted') } - ] + ],[]) return ( <>