@@ -121,7 +121,6 @@ export class DashboardComponent
121
121
takeUntil ( this . destroy$ )
122
122
)
123
123
. subscribe ( ( ) => {
124
- this . loading = true ;
125
124
// Reset scroll when changing page
126
125
const pageContainer = this . document . getElementById ( 'appPageContainer' ) ;
127
126
if ( pageContainer ) {
@@ -133,9 +132,7 @@ export class DashboardComponent
133
132
/** Extract query id to load template */
134
133
const queryId = this . route . snapshot . queryParamMap . get ( 'id' ) ;
135
134
if ( id ) {
136
- this . loadDashboard ( id , queryId ?. trim ( ) ) . then (
137
- ( ) => ( this . loading = false )
138
- ) ;
135
+ this . loadDashboard ( id , queryId ?. trim ( ) ) ;
139
136
}
140
137
} ) ;
141
138
}
@@ -156,9 +153,10 @@ export class DashboardComponent
156
153
?. filter ( ( x : any ) => x !== null )
157
154
. map ( ( widget : any ) => {
158
155
const contextData = this . dashboard ?. contextData ;
159
- this . contextService . context =
160
- { id : this . contextId , ...contextData } || null ;
161
- if ( ! contextData ) {
156
+ this . contextService . context = this . contextId
157
+ ? { id : this . contextId , ...contextData }
158
+ : null ;
159
+ if ( contextData ) {
162
160
return widget ;
163
161
}
164
162
const { settings, originalSettings } =
@@ -184,11 +182,6 @@ export class DashboardComponent
184
182
* @returns Promise
185
183
*/
186
184
private async loadDashboard ( id : string , contextId ?: string ) {
187
- // don't init the dashboard if the id is the same
188
- if ( this . dashboard ?. id === id && this . contextId === contextId ) {
189
- return ;
190
- }
191
-
192
185
const rootElement = this . elementRef . nativeElement ;
193
186
// Doing this to be able to use custom styles on specific dashboards
194
187
this . renderer . setAttribute ( rootElement , 'data-dashboard-id' , id ) ;
@@ -242,6 +235,7 @@ export class DashboardComponent
242
235
) ;
243
236
this . router . navigate ( [ '/' ] ) ;
244
237
}
238
+ this . loading = false ;
245
239
} )
246
240
. catch ( ( err ) => {
247
241
this . snackBar . openSnackBar ( err . message , { error : true } ) ;
0 commit comments