refactor: 💡 remove redundant code

This commit is contained in:
Jin
2025-03-18 17:39:59 +01:00
parent 0858f531e4
commit e12be14dc9
2 changed files with 6 additions and 12 deletions

View File

@@ -550,9 +550,7 @@ export default class TabManager extends Component {
}
async closeActiveTabCommand() {
if (this.activeNtxId) {
await this.removeNoteContext(this.activeNtxId);
}
await this.removeNoteContext(this.activeNtxId);
}
beforeUnloadEvent(): boolean {
@@ -566,15 +564,13 @@ export default class TabManager extends Component {
async closeAllTabsCommand() {
for (const ntxIdToRemove of this.mainNoteContexts.map((nc) => nc.ntxId)) {
if (ntxIdToRemove) {
await this.removeNoteContext(ntxIdToRemove);
}
await this.removeNoteContext(ntxIdToRemove);
}
}
async closeOtherTabsCommand({ ntxId }: { ntxId: string }) {
for (const ntxIdToRemove of this.mainNoteContexts.map((nc) => nc.ntxId)) {
if (ntxIdToRemove && ntxIdToRemove !== ntxId) {
if (ntxIdToRemove !== ntxId) {
await this.removeNoteContext(ntxIdToRemove);
}
}
@@ -587,9 +583,7 @@ export default class TabManager extends Component {
if (index !== -1) {
const idsToRemove = ntxIds.slice(index + 1);
for (const ntxIdToRemove of idsToRemove) {
if (ntxIdToRemove) {
await this.removeNoteContext(ntxIdToRemove);
}
await this.removeNoteContext(ntxIdToRemove);
}
}
}