mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-02 14:16:39 +01:00
If self, don't need to get familiar followers
This commit is contained in:
parent
62201b0250
commit
5ac255f808
1 changed files with 8 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
|||
import './account-info.css';
|
||||
|
||||
import { Menu, MenuDivider, MenuItem, SubMenu } from '@szhsin/react-menu';
|
||||
import { useEffect, useReducer, useRef, useState } from 'preact/hooks';
|
||||
import { useEffect, useMemo, useReducer, useRef, useState } from 'preact/hooks';
|
||||
|
||||
import { api } from '../utils/api';
|
||||
import enhanceContent from '../utils/enhance-content';
|
||||
|
@ -62,6 +62,11 @@ function AccountInfo({
|
|||
const isString = typeof account === 'string';
|
||||
const [info, setInfo] = useState(isString ? null : account);
|
||||
|
||||
const isSelf = useMemo(
|
||||
() => account.id === store.session.get('currentAccount'),
|
||||
[account?.id],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isString) {
|
||||
setInfo(account);
|
||||
|
@ -128,6 +133,8 @@ function AccountInfo({
|
|||
});
|
||||
}
|
||||
const results = await followersIterator.current.next();
|
||||
if (isSelf) return results;
|
||||
|
||||
const { value } = results;
|
||||
let newValue = [];
|
||||
// On first load, fetch familiar followers, merge to top of results' `value`
|
||||
|
|
Loading…
Reference in a new issue