Skip to content

Commit

Permalink
fix(terminal): #9323 clone real tab options object instead of proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
Clem-Fern committed Oct 15, 2024
1 parent ab97bb0 commit f37a492
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions tabby-terminal/src/tabContextMenu.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { Injectable, Optional, Inject } from '@angular/core'
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
import { BaseTabComponent, TabContextMenuItemProvider, NotificationsService, MenuItemOptions, TranslateService, SplitTabComponent, PromptModalComponent, ConfigService, PartialProfile, Profile } from 'tabby-core'
import { BaseTabComponent, TabContextMenuItemProvider, NotificationsService, MenuItemOptions, TranslateService, SplitTabComponent, PromptModalComponent, ConfigService, PartialProfile, Profile, ProfilesService, ConfigProxy } from 'tabby-core'
import { BaseTerminalTabComponent } from './api/baseTerminalTab.component'
import { TerminalContextMenuItemProvider } from './api/contextMenuProvider'
import { MultifocusService } from './services/multifocus.service'
import { ConnectableTerminalTabComponent } from './api/connectableTerminalTab.component'
import { v4 as uuidv4 } from 'uuid'
import slugify from 'slugify'

/** @hidden */
@Injectable()
Expand Down Expand Up @@ -162,6 +160,7 @@ export class SaveAsProfileContextMenu extends TabContextMenuItemProvider {
private ngbModal: NgbModal,
private notifications: NotificationsService,
private translate: TranslateService,
private profilesService: ProfilesService,
) {
super()
}
Expand All @@ -180,9 +179,8 @@ export class SaveAsProfileContextMenu extends TabContextMenuItemProvider {
return
}

const options = {
...tab.profile.options,
}
const tab_options = tab.profile.options instanceof ConfigProxy ? (tab.profile.options as ConfigProxy).__getReal() : tab.profile.options
const options = {...tab_options}

Check failure on line 183 in tabby-terminal/src/tabContextMenu.ts

View workflow job for this annotation

GitHub Actions / Lint

A space is required after '{'

Check failure on line 183 in tabby-terminal/src/tabContextMenu.ts

View workflow job for this annotation

GitHub Actions / Lint

A space is required before '}'

const cwd = await tab.session?.getWorkingDirectory() ?? tab.profile.options.cwd
if (cwd) {
Expand All @@ -195,18 +193,18 @@ export class SaveAsProfileContextMenu extends TabContextMenuItemProvider {
options,
}

profile.id = `${profile.type}:custom:${slugify(name)}:${uuidv4()}`
profile.group = tab.profile.group
profile.icon = tab.profile.icon
profile.color = tab.profile.color
profile.disableDynamicTitle = tab.profile.disableDynamicTitle
profile.behaviorOnSessionEnd = tab.profile.behaviorOnSessionEnd

this.config.store.profiles = [
...this.config.store.profiles,
profile,
]
this.profilesService.getConfigProxyForProfile(profile).__cleanup()
profile.type = tab.profile.type

this.profilesService.newProfile(profile)
this.config.save()

this.notifications.info(this.translate.instant('Saved'))
},
},
Expand Down

0 comments on commit f37a492

Please sign in to comment.