pl-fe: Remove excessive calls to fetchOwnAccounts

Signed-off-by: mkljczk <git@mkljczk.pl>
This commit is contained in:
mkljczk
2025-01-29 19:38:24 +01:00
parent 24c20860ca
commit 0c435d40bb

View File

@ -1,11 +1,10 @@
import clsx from 'clsx';
import throttle from 'lodash/throttle';
import React, { useEffect, useMemo } from 'react';
import React, { useMemo } from 'react';
import { defineMessages, useIntl } from 'react-intl';
import { Link } from 'react-router-dom';
import { createSelector } from 'reselect';
import { fetchOwnAccounts, logOut, switchAccount } from 'pl-fe/actions/auth';
import { logOut, switchAccount } from 'pl-fe/actions/auth';
import Account from 'pl-fe/components/account';
import DropdownMenu from 'pl-fe/components/dropdown-menu';
import { Entities } from 'pl-fe/entity-store/entities';
@ -57,10 +56,6 @@ const ProfileDropdown: React.FC<IProfileDropdown> = ({ account, children }) => {
dispatch(switchAccount(account.id));
};
const fetchOwnAccountThrottled = throttle(() => {
dispatch(fetchOwnAccounts());
}, 2000);
const renderAccount = (account: AccountEntity) => (
<Account account={account} showAccountHoverCard={false} withLinkToProfile={false} hideActions />
);
@ -105,10 +100,6 @@ const ProfileDropdown: React.FC<IProfileDropdown> = ({ account, children }) => {
);
}, [account, otherAccounts.length, features]);
useEffect(() => {
fetchOwnAccountThrottled();
}, [account.id, otherAccounts.length]);
return (
<DropdownMenu
component={ProfileDropdownMenu}