Deepclone profile before passing it to the configuration component and fix uncaught error on modal dismiss

This commit is contained in:
highfredo 2021-11-21 13:43:02 +01:00
parent 8ff130ebfd
commit 905e7ffc43

View File

@ -100,10 +100,10 @@ export class ProfilesSettingsTabComponent extends BaseComponent {
if (!provider) {
throw new Error('Cannot edit a profile without a provider')
}
modal.componentInstance.profile = Object.assign({}, profile)
modal.componentInstance.profile = deepClone(profile)
modal.componentInstance.profileProvider = provider
try {
const result = await modal.result
// Fully replace the config
for (const k in profile) {
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
@ -112,6 +112,7 @@ export class ProfilesSettingsTabComponent extends BaseComponent {
Object.assign(profile, result)
profile.type = provider.id
} catch (e) { }
}
async deleteProfile (profile: PartialProfile<Profile>): Promise<void> {