Skip to content

Commit c989796

Browse files
committed
fix(Admin UI): handle cases where viewConfig is not available
1 parent dc61724 commit c989796

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/app/core/admin/admin-entity/admin-entity.component.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,15 @@ export class AdminEntityComponent implements OnInit {
101101
this.configEntitySettings = this.entityConstructor;
102102
}
103103

104-
private loadViewConfig<C = EntityDetailsConfig | EntityListConfig>(
105-
viewId: string,
106-
): C | undefined {
104+
private loadViewConfig<
105+
C = EntityDetailsConfig | EntityListConfig | undefined,
106+
>(viewId: string): C | undefined {
107107
const viewConfig: ViewConfig<C> = this.configService.getConfig(viewId);
108108

109109
// work on a deep copy as we are editing in place (for titles, sections, etc.)
110-
return JSON.parse(JSON.stringify(viewConfig.config));
110+
return viewConfig?.config
111+
? JSON.parse(JSON.stringify(viewConfig.config))
112+
: undefined;
111113
}
112114

113115
cancel() {

0 commit comments

Comments
 (0)