Skip to content

Commit 0ab8dbc

Browse files
committed
fix auto reload of dashboard on button edit action
1 parent 79ba512 commit 0ab8dbc

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

apps/front-office/src/app/application/pages/dashboard/dashboard.component.ts

+6-12
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ export class DashboardComponent
121121
takeUntil(this.destroy$)
122122
)
123123
.subscribe(() => {
124-
this.loading = true;
125124
// Reset scroll when changing page
126125
const pageContainer = this.document.getElementById('appPageContainer');
127126
if (pageContainer) {
@@ -133,9 +132,7 @@ export class DashboardComponent
133132
/** Extract query id to load template */
134133
const queryId = this.route.snapshot.queryParamMap.get('id');
135134
if (id) {
136-
this.loadDashboard(id, queryId?.trim()).then(
137-
() => (this.loading = false)
138-
);
135+
this.loadDashboard(id, queryId?.trim());
139136
}
140137
});
141138
}
@@ -156,9 +153,10 @@ export class DashboardComponent
156153
?.filter((x: any) => x !== null)
157154
.map((widget: any) => {
158155
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) {
162160
return widget;
163161
}
164162
const { settings, originalSettings } =
@@ -184,11 +182,6 @@ export class DashboardComponent
184182
* @returns Promise
185183
*/
186184
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-
192185
const rootElement = this.elementRef.nativeElement;
193186
// Doing this to be able to use custom styles on specific dashboards
194187
this.renderer.setAttribute(rootElement, 'data-dashboard-id', id);
@@ -242,6 +235,7 @@ export class DashboardComponent
242235
);
243236
this.router.navigate(['/']);
244237
}
238+
this.loading = false;
245239
})
246240
.catch((err) => {
247241
this.snackBar.openSnackBar(err.message, { error: true });

0 commit comments

Comments
 (0)