From 0c435d40bb37d2f6c2467268417f747bdc0cce34 Mon Sep 17 00:00:00 2001 From: mkljczk Date: Wed, 29 Jan 2025 19:38:24 +0100 Subject: [PATCH] pl-fe: Remove excessive calls to fetchOwnAccounts Signed-off-by: mkljczk --- .../src/features/ui/components/profile-dropdown.tsx | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/packages/pl-fe/src/features/ui/components/profile-dropdown.tsx b/packages/pl-fe/src/features/ui/components/profile-dropdown.tsx index e6053fa2a..6c8a28cd7 100644 --- a/packages/pl-fe/src/features/ui/components/profile-dropdown.tsx +++ b/packages/pl-fe/src/features/ui/components/profile-dropdown.tsx @@ -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 = ({ account, children }) => { dispatch(switchAccount(account.id)); }; - const fetchOwnAccountThrottled = throttle(() => { - dispatch(fetchOwnAccounts()); - }, 2000); - const renderAccount = (account: AccountEntity) => ( ); @@ -105,10 +100,6 @@ const ProfileDropdown: React.FC = ({ account, children }) => { ); }, [account, otherAccounts.length, features]); - useEffect(() => { - fetchOwnAccountThrottled(); - }, [account.id, otherAccounts.length]); - return (