Skip to content

Commit

Permalink
fix(Admin UI): create default view configs to avoid errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sleidig committed Jul 2, 2024
1 parent 9ff08e2 commit 2306101
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/app/core/admin/admin-entity/admin-entity.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,16 @@ export class AdminEntityComponent implements OnInit {

this.configDetailsView = this.loadViewConfig(
EntityConfigService.getDetailsViewId(this.entityConstructor),
);
) ?? { entityType: this.entityType, panels: [] };
this.configListView = this.loadViewConfig(
EntityConfigService.getListViewId(this.entityConstructor),
);
) ?? { entityType: this.entityType };
this.configEntitySettings = this.entityConstructor;
}

private loadViewConfig<C = EntityDetailsConfig | EntityListConfig>(
viewId: string,
): C {
): C | undefined {
const viewConfig: ViewConfig<C> = this.configService.getConfig(viewId);

// work on a deep copy as we are editing in place (for titles, sections, etc.)
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/config/config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class ConfigService extends LatestEntityLoader<Config> {
return JSON.stringify(this.currentConfig.data);
}

public getConfig<T>(id: string): T {
public getConfig<T>(id: string): T | undefined {
return this.currentConfig.data[id];
}

Expand Down

0 comments on commit 2306101

Please sign in to comment.