Skip to content

Commit 52fe548

Browse files
committed
[Fix]: #1849 optimize api calls for advanced setting page
1 parent 64b7f58 commit 52fe548

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

client/packages/lowcoder/src/pages/setting/advanced/AdvancedSetting.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,18 @@ export function AdvancedSetting() {
9696
}, [currentUser.currentOrgId])
9797

9898
useEffect(() => {
99-
dispatch(fetchCommonSettings({ orgId: currentUser.currentOrgId }));
100-
dispatch(fetchAllApplications({}));
101-
}, [currentUser.currentOrgId, dispatch]);
99+
// Only fetch common settings if not already loaded
100+
if (Object.keys(commonSettings).length === 0) {
101+
dispatch(fetchCommonSettings({ orgId: currentUser.currentOrgId }));
102+
}
103+
}, [currentUser.currentOrgId, dispatch, commonSettings]);
104+
105+
// Lazy load applications only when dropdown is opened
106+
const handleDropdownOpen = () => {
107+
if (appList.length === 0) {
108+
dispatch(fetchAllApplications({}));
109+
}
110+
};
102111

103112
useEffect(() => {
104113
setSettings(commonSettings);
@@ -176,6 +185,9 @@ export function AdvancedSetting() {
176185
onChange={(value: string) => {
177186
setSettings((v) => ({ ...v, defaultHomePage: value }));
178187
}}
188+
onDropdownVisibleChange={(open) => {
189+
if (open) handleDropdownOpen();
190+
}}
179191
options={appListOptions}
180192
filterOption={(input, option) => (option?.label as string).includes(input)}
181193
/>

0 commit comments

Comments
 (0)