Skip to content

Commit 9e10673

Browse files
committed
[Fix]: #1848 remove duplicate folderelements request from Home
1 parent c8f9e3d commit 9e10673

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

client/packages/lowcoder/src/pages/ApplicationV2/FolderView.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import { Helmet } from "react-helmet";
99
import { trans } from "i18n";
1010
import {ApplicationPaginationType} from "@lowcoder-ee/util/pagination/type";
1111
import {fetchFolderElements} from "@lowcoder-ee/util/pagination/axios";
12+
import { fetchFolderElements as fetchFolderElementsRedux } from "../../redux/reduxActions/folderActions";
13+
import { getUser } from "../../redux/selectors/usersSelectors";
1214

1315
function getBreadcrumbs(
1416
folder: FolderMeta,
@@ -52,6 +54,7 @@ export function FolderView() {
5254

5355
const element = useSelector(folderElementsSelector);
5456
const allFolders = useSelector(foldersSelector);
57+
const user = useSelector(getUser);
5558

5659
const folder = allFolders.filter((f) => f.folderId === folderId)[0] || {};
5760
const breadcrumbs = getBreadcrumbs(folder, allFolders, [
@@ -61,6 +64,13 @@ export function FolderView() {
6164
},
6265
]);
6366

67+
// Fetch folder data for breadcrumbs if not available
68+
useEffect(() => {
69+
if (allFolders.length === 0 && user.currentOrgId) {
70+
dispatch(fetchFolderElementsRedux({}));
71+
}
72+
}, [allFolders.length, user.currentOrgId, dispatch]);
73+
6474
useEffect( () => {
6575
try{
6676
fetchFolderElements({

client/packages/lowcoder/src/pages/ApplicationV2/index.tsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,6 @@ export default function ApplicationHome() {
124124
setIsPreloadCompleted(true);
125125
}, [org, orgHomeId]);
126126

127-
useEffect(() => {
128-
// Check if we need to fetch data (either no folders or no applications)
129-
if (allFoldersCount !== 0 && allAppCount !== 0) {
130-
return;
131-
}
132-
133-
user.currentOrgId && dispatch(fetchFolderElements({}));
134-
}, [dispatch, allFoldersCount, allAppCount, user.currentOrgId]);
135-
136127
if (fetchingUser || !isPreloadCompleted) {
137128
return <ProductLoading />;
138129
}

0 commit comments

Comments
 (0)