1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-11-30 02:54:04 +03:00

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,18 +100,19 @@ 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
const result = await modal.result
try {
const result = await modal.result
// Fully replace the config
for (const k in profile) {
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
delete profile[k]
}
Object.assign(profile, result)
// Fully replace the config
for (const k in profile) {
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
delete profile[k]
}
Object.assign(profile, result)
profile.type = provider.id
profile.type = provider.id
} catch (e) { }
}
async deleteProfile (profile: PartialProfile<Profile>): Promise<void> {