Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a902532

Browse files
committed
add page size param
1 parent 049d372 commit a902532

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,8 @@ export default function ProfileDropdown(props: DropDownProps) {
253253
// Load workspaces when dropdown opens for the first time
254254
useEffect(() => {
255255
if (dropdownVisible && workspaces.items.length === 0) {
256-
dispatch(fetchWorkspacesAction(1));
256+
// fetch all workspaces for the dropdown
257+
dispatch(fetchWorkspacesAction(1, 1000));
257258
}
258259
}, [dropdownVisible, workspaces.items.length, dispatch]);
259260

‎client/packages/lowcoder/src/redux/reduxActions/orgActions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,9 @@ export const fetchLastMonthAPIUsageActionSuccess = (payload: OrgLastMonthAPIUsag
193193
};
194194
};
195195

196-
export const fetchWorkspacesAction = (page: number = 1, search?: string, isLoadMore?: boolean) => ({
196+
export const fetchWorkspacesAction = (page: number = 1,pageSize: number = 20, search?: string, isLoadMore?: boolean) => ({
197197
type: ReduxActionTypes.FETCH_WORKSPACES_INIT,
198-
payload: { page, search, isLoadMore }
198+
payload: { page, pageSize, search, isLoadMore }
199199
});
200200

201201
export const loadMoreWorkspacesAction = (page: number, search?: string) => ({

‎client/packages/lowcoder/src/redux/sagas/orgSagas.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,14 +328,14 @@ export function* fetchLastMonthAPIUsageSaga(action: ReduxAction<{
328328

329329
// fetch my orgs
330330
// In userSagas.ts
331-
export function* fetchWorkspacesSaga(action: ReduxAction<{page: number, search?: string, isLoadMore?: boolean}>) {
331+
export function* fetchWorkspacesSaga(action: ReduxAction<{page: number, pageSize: number, search?: string, isLoadMore?: boolean}>) {
332332
try {
333-
const { page, search, isLoadMore } = action.payload;
333+
const { page, pageSize, search, isLoadMore } = action.payload;
334334

335335
const response: AxiosResponse<GetMyOrgsResponse> = yield call(
336336
UserApi.getMyOrgs,
337337
page, // pageNum
338-
5, // pageSize (changed to 5 for testing)
338+
pageSize, // pageSize (changed to 5 for testing)
339339
search // orgName
340340
);
341341

0 commit comments

Comments
 (0)