@@ -34,28 +34,52 @@ import {
34
34
import React , { useEffect , useState } from "react" ;
35
35
import { fetchAllApplications , fetchHomeData } from "redux/reduxActions/applicationActions" ;
36
36
import { getHomeOrg , normalAppListSelector } from "redux/selectors/applicationSelector" ;
37
- import { DatasourceHome } from "../datasource" ;
37
+ // import { DatasourceHome } from "../datasource";
38
38
import { clearStyleEval , evalStyle } from "lowcoder-core" ;
39
- import { QueryLibraryEditor } from "../queryLibrary/QueryLibraryEditor" ;
39
+ // import { QueryLibraryEditor } from "../queryLibrary/QueryLibraryEditor";
40
40
import { ProductLoading } from "components/ProductLoading" ;
41
41
import { Layout } from "../../components/layout/Layout" ;
42
- import { HomeView } from "./HomeView" ;
42
+ // import { HomeView } from "./HomeView";
43
43
import styled , { css } from "styled-components" ;
44
44
import history from "../../util/history" ;
45
- import { FolderView } from "./FolderView" ;
46
- import { TrashView } from "./TrashView" ;
45
+ // import { FolderView } from "./FolderView";
46
+ // import { TrashView } from "./TrashView";
47
47
import { SideBarItemType } from "../../components/layout/SideBarSection" ;
48
- import { RootFolderListView } from "./RootFolderListView" ;
48
+ // import { RootFolderListView } from "./RootFolderListView";
49
49
import InviteDialog from "../common/inviteDialog" ;
50
50
import { fetchFolderElements , updateFolder } from "../../redux/reduxActions/folderActions" ;
51
- import { ModuleView } from "./ModuleView" ;
51
+ // import { ModuleView } from "./ModuleView";
52
52
import { useCreateFolder } from "./useCreateFolder" ;
53
53
import { trans } from "../../i18n" ;
54
54
import { foldersSelector } from "../../redux/selectors/folderSelector" ;
55
- import Setting from "pages/setting" ;
55
+ // import Setting from "pages/setting";
56
56
import { TypographyText } from "../../components/TypographyText" ;
57
57
import { messageInstance } from "lowcoder-design" ;
58
58
59
+ const LazyFolderView = React . lazy (
60
+ ( ) => import ( "./FolderView" ) . then ( module => ( { default : module . FolderView } ) )
61
+ ) ;
62
+ const LazyRootFolderListView = React . lazy (
63
+ ( ) => import ( "./RootFolderListView" ) . then ( module => ( { default : module . RootFolderListView } ) )
64
+ ) ;
65
+ const LazyTrashView = React . lazy (
66
+ ( ) => import ( "./TrashView" ) . then ( module => ( { default : module . TrashView } ) )
67
+ ) ;
68
+ const LazyModuleView = React . lazy (
69
+ ( ) => import ( "./ModuleView" ) . then ( module => ( { default : module . ModuleView } ) )
70
+ ) ;
71
+ const LazyHomeView = React . lazy (
72
+ ( ) => import ( "./HomeView" ) . then ( module => ( { default : module . HomeView } ) )
73
+ ) ;
74
+ const LazyDatasourceHome = React . lazy (
75
+ ( ) => import ( "../datasource" ) . then ( module => ( { default : module . DatasourceHome } ) )
76
+ ) ;
77
+ const LazyQueryLibraryEditor = React . lazy (
78
+ ( ) => import ( "../queryLibrary/QueryLibraryEditor" ) . then ( module => ( { default : module . QueryLibraryEditor } ) )
79
+ ) ;
80
+ const LazySetting = React . lazy ( ( ) => import ( "pages/setting" ) ) ;
81
+
82
+
59
83
const TabLabel = styled . div `
60
84
font-weight: 500;
61
85
` ;
@@ -298,7 +322,8 @@ export default function ApplicationHome() {
298
322
) ,
299
323
routePath : FOLDER_URL ,
300
324
routePathExact : false ,
301
- routeComp : FolderView ,
325
+ // routeComp: FolderView,
326
+ routeComp : LazyFolderView ,
302
327
icon : FolderIcon ,
303
328
size : "small" ,
304
329
onClick : ( currentPath ) => currentPath !== path && history . push ( path ) ,
@@ -313,7 +338,7 @@ export default function ApplicationHome() {
313
338
< MoreFoldersWrapper $selected = { Boolean ( props . selected ) } > { trans ( "more" ) } </ MoreFoldersWrapper >
314
339
) ,
315
340
routePath : FOLDERS_URL ,
316
- routeComp : RootFolderListView ,
341
+ routeComp : LazyRootFolderListView ,
317
342
icon : MoreFoldersIcon ,
318
343
size : "small" ,
319
344
} ,
@@ -336,14 +361,14 @@ export default function ApplicationHome() {
336
361
{
337
362
text : < TabLabel > { trans ( "home.allApplications" ) } </ TabLabel > ,
338
363
routePath : ALL_APPLICATIONS_URL ,
339
- routeComp : HomeView ,
364
+ routeComp : LazyHomeView ,
340
365
icon : ( { selected, ...otherProps } ) =>
341
366
selected ? < HomeActiveIcon { ...otherProps } /> : < HomeIcon { ...otherProps } /> ,
342
367
} ,
343
368
{
344
369
text : < TabLabel > { trans ( "home.modules" ) } </ TabLabel > ,
345
370
routePath : MODULE_APPLICATIONS_URL ,
346
- routeComp : ModuleView ,
371
+ routeComp : LazyModuleView ,
347
372
icon : ( { selected, ...otherProps } ) =>
348
373
selected ? (
349
374
< HomeModuleActiveIcon { ...otherProps } />
@@ -355,7 +380,8 @@ export default function ApplicationHome() {
355
380
{
356
381
text : < TabLabel > { trans ( "home.trash" ) } </ TabLabel > ,
357
382
routePath : TRASH_URL ,
358
- routeComp : TrashView ,
383
+ // routeComp: TrashView,
384
+ routeComp : LazyTrashView ,
359
385
icon : ( { selected, ...otherProps } ) =>
360
386
selected ? (
361
387
< RecyclerActiveIcon { ...otherProps } />
@@ -388,7 +414,7 @@ export default function ApplicationHome() {
388
414
{
389
415
text : < TabLabel > { trans ( "home.queryLibrary" ) } </ TabLabel > ,
390
416
routePath : QUERY_LIBRARY_URL ,
391
- routeComp : QueryLibraryEditor ,
417
+ routeComp : LazyQueryLibraryEditor ,
392
418
icon : ( { selected, ...otherProps } ) =>
393
419
selected ? (
394
420
< HomeQueryLibraryActiveIcon { ...otherProps } />
@@ -401,7 +427,7 @@ export default function ApplicationHome() {
401
427
text : < TabLabel > { trans ( "home.datasource" ) } </ TabLabel > ,
402
428
routePath : DATASOURCE_URL ,
403
429
routePathExact : false ,
404
- routeComp : DatasourceHome ,
430
+ routeComp : LazyDatasourceHome ,
405
431
icon : ( { selected, ...otherProps } ) =>
406
432
selected ? (
407
433
< HomeDataSourceActiveIcon { ...otherProps } />
@@ -415,7 +441,7 @@ export default function ApplicationHome() {
415
441
text : < TabLabel > { trans ( "settings.title" ) } </ TabLabel > ,
416
442
routePath : SETTING ,
417
443
routePathExact : false ,
418
- routeComp : Setting ,
444
+ routeComp : LazySetting ,
419
445
icon : ( { selected, ...otherProps } ) =>
420
446
selected ? (
421
447
< HomeSettingsActiveIcon { ...otherProps } />
0 commit comments