Skip to content

Commit e202fcb

Browse files
committed
remove dispatch from the profile dropdown
1 parent 7709d58 commit e202fcb

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

client/packages/lowcoder/src/pages/common/profileDropdown.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -250,13 +250,7 @@ export default function ProfileDropdown(props: DropDownProps) {
250250
const [dropdownVisible, setDropdownVisible] = useState(false);
251251

252252

253-
// Load workspaces when dropdown opens for the first time
254-
useEffect(() => {
255-
if (dropdownVisible && workspaces.items.length === 0) {
256-
// fetch all workspaces for the dropdown
257-
dispatch(fetchWorkspacesAction(1, 1000));
258-
}
259-
}, [dropdownVisible, workspaces.items.length, dispatch]);
253+
260254

261255
const filteredOrgs = useMemo(() => {
262256
if (!searchTerm.trim()) return workspaces.items;

client/packages/lowcoder/src/redux/sagas/userSagas.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { messageInstance } from "lowcoder-design/src/components/GlobalInstances"
2525
import { AuthSearchParams } from "constants/authConstants";
2626
import { saveAuthSearchParams } from "pages/userAuth/authUtils";
2727
import { initTranslator } from "i18n";
28+
import { fetchWorkspacesAction } from "../reduxActions/orgActions";
2829

2930
function validResponseData(response: AxiosResponse<ApiResponse>) {
3031
return response && response.data && response.data.data;
@@ -71,10 +72,13 @@ export function* getUserSaga() {
7172
orgs: orgs,
7273
orgRoleMap: orgRoleMap,
7374
};
75+
7476
yield put({
7577
type: ReduxActionTypes.FETCH_USER_DETAILS_SUCCESS,
7678
payload: user,
7779
});
80+
// fetch all workspaces and store in redux
81+
yield put(fetchWorkspacesAction(1, 1000));
7882
}
7983
} catch (error: any) {
8084
yield put({

0 commit comments

Comments
 (0)