1- import React , { useEffect } from 'react' ;
2- import NeoNotificationModal from '../modal/NotificationModal' ;
1+ import React , { Suspense , useEffect } from 'react' ;
32import NeoWelcomeScreenModal from '../modal/WelcomeScreenModal' ;
43import { connect } from 'react-redux' ;
54import {
@@ -39,17 +38,20 @@ import {
3938import { resetDashboardState } from '../dashboard/DashboardActions' ;
4039import { NeoDashboardPlaceholder } from '../dashboard/placeholder/DashboardPlaceholder' ;
4140import NeoConnectionModal from '../modal/ConnectionModal' ;
42- import Dashboard from '../dashboard/Dashboard' ;
43- import NeoAboutModal from '../modal/AboutModal' ;
44- import { NeoUpgradeOldDashboardModal } from '../modal/UpgradeOldDashboardModal' ;
41+
4542import { loadDashboardThunk } from '../dashboard/DashboardThunks' ;
46- import { NeoLoadSharedDashboardModal } from '../modal/LoadSharedDashboardModal' ;
4743import { downloadComponentAsImage } from '../chart/ChartUtils' ;
48- import NeoReportHelpModal from '../modal/ReportHelpModal' ;
4944import '@neo4j-ndl/base/lib/neo4j-ds-styles.css' ;
5045import { resetSessionStorage } from '../sessionStorage/SessionStorageActions' ;
5146import { getDashboardTheme } from '../dashboard/DashboardSelectors' ;
5247
48+ const NeoUpgradeOldDashboardModal = React . lazy ( ( ) => import ( '../modal/UpgradeOldDashboardModal' ) ) ;
49+ const NeoLoadSharedDashboardModal = React . lazy ( ( ) => import ( '../modal/LoadSharedDashboardModal' ) ) ;
50+ const NeoReportHelpModal = React . lazy ( ( ) => import ( '../modal/ReportHelpModal' ) ) ;
51+ const NeoNotificationModal = React . lazy ( ( ) => import ( '../modal/NotificationModal' ) ) ;
52+ const NeoAboutModal = React . lazy ( ( ) => import ( '../modal/AboutModal' ) ) ;
53+ const Dashboard = React . lazy ( ( ) => import ( '../dashboard/Dashboard' ) ) ;
54+
5355/**
5456 * This is the main application component for NeoDash.
5557 * It contains:
@@ -122,16 +124,20 @@ const Application = ({
122124 className = { `n-bg-palette-neutral-bg-default n-h-screen n-w-screen n-flex n-flex-col n-overflow-hidden` }
123125 >
124126 { connected ? (
125- < Dashboard
126- onDownloadDashboardAsImage = { ( _ ) => downloadComponentAsImage ( ref ) }
127- onAboutModalOpen = { onAboutModalOpen }
128- resetApplication = { resetApplication }
129- > </ Dashboard >
127+ < Suspense fallback = '' >
128+ < Dashboard
129+ onDownloadDashboardAsImage = { ( _ ) => downloadComponentAsImage ( ref ) }
130+ onAboutModalOpen = { onAboutModalOpen }
131+ resetApplication = { resetApplication }
132+ > </ Dashboard >
133+ </ Suspense >
130134 ) : (
131135 < NeoDashboardPlaceholder > </ NeoDashboardPlaceholder >
132136 ) }
133137 { /* TODO - move all models into a pop-ups (or modals) component. */ }
134- < NeoAboutModal open = { aboutModalOpen } handleClose = { onAboutModalClose } getDebugState = { getDebugState } />
138+ < Suspense fallback = '' >
139+ < NeoAboutModal open = { aboutModalOpen } handleClose = { onAboutModalClose } getDebugState = { getDebugState } />
140+ </ Suspense >
135141 < NeoConnectionModal
136142 open = { connectionModalOpen }
137143 dismissable = { connected }
@@ -154,19 +160,27 @@ const Application = ({
154160 onAboutModalOpen = { onAboutModalOpen }
155161 resetDashboard = { resetDashboard }
156162 > </ NeoWelcomeScreenModal >
157- < NeoUpgradeOldDashboardModal
158- open = { oldDashboard }
159- text = { oldDashboard }
160- loadDashboard = { loadDashboard }
161- clearOldDashboard = { clearOldDashboard }
162- />
163- < NeoLoadSharedDashboardModal
164- shareDetails = { shareDetails }
165- onResetShareDetails = { onResetShareDetails }
166- onConfirmLoadSharedDashboard = { onConfirmLoadSharedDashboard }
167- />
168- < NeoReportHelpModal open = { reportHelpModalOpen } handleClose = { onReportHelpModalClose } />
169- < NeoNotificationModal > </ NeoNotificationModal >
163+ < Suspense fallback = '' >
164+ < NeoUpgradeOldDashboardModal
165+ open = { oldDashboard }
166+ text = { oldDashboard }
167+ loadDashboard = { loadDashboard }
168+ clearOldDashboard = { clearOldDashboard }
169+ />
170+ </ Suspense >
171+ < Suspense fallback = '' >
172+ < NeoLoadSharedDashboardModal
173+ shareDetails = { shareDetails }
174+ onResetShareDetails = { onResetShareDetails }
175+ onConfirmLoadSharedDashboard = { onConfirmLoadSharedDashboard }
176+ />
177+ </ Suspense >
178+ < Suspense fallback = '' >
179+ < NeoReportHelpModal open = { reportHelpModalOpen } handleClose = { onReportHelpModalClose } />
180+ </ Suspense >
181+ < Suspense fallback = '' >
182+ < NeoNotificationModal > </ NeoNotificationModal >
183+ </ Suspense >
170184 </ div >
171185 ) ;
172186} ;
0 commit comments