mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-20 03:20:12 +00:00
Deepclone profile before passing it to the configuration component and fix uncaught error on modal dismiss
This commit is contained in:
parent
8ff130ebfd
commit
905e7ffc43
@ -100,18 +100,19 @@ export class ProfilesSettingsTabComponent extends BaseComponent {
|
|||||||
if (!provider) {
|
if (!provider) {
|
||||||
throw new Error('Cannot edit a profile without a 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
|
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
|
profile.type = provider.id
|
||||||
for (const k in profile) {
|
} catch (e) { }
|
||||||
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
||||||
delete profile[k]
|
|
||||||
}
|
|
||||||
Object.assign(profile, result)
|
|
||||||
|
|
||||||
profile.type = provider.id
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async deleteProfile (profile: PartialProfile<Profile>): Promise<void> {
|
async deleteProfile (profile: PartialProfile<Profile>): Promise<void> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user