Skip to content

Commit f653019

Browse files
committed
fix: duplicated status bar
close #892
1 parent 485e4cd commit f653019

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,8 @@ export default class ObsidianGit extends Plugin {
485485
this.automaticsManager.unload();
486486
this.branchBar?.remove();
487487
this.statusBar?.remove();
488+
this.statusBar = undefined;
489+
this.branchBar = undefined;
488490
this.gitManager.unload();
489491
this.promiseQueue.clear();
490492

@@ -522,7 +524,7 @@ export default class ObsidianGit extends Plugin {
522524
}
523525

524526
async init({ fromReload = false }): Promise<void> {
525-
if (this.settings.showStatusBar) {
527+
if (this.settings.showStatusBar && !this.statusBar) {
526528
const statusBarEl = this.addStatusBarItem();
527529
this.statusBar = new StatusBar(statusBarEl, this);
528530
this.intervalsToClear.push(
@@ -557,7 +559,8 @@ export default class ObsidianGit extends Plugin {
557559

558560
if (
559561
Platform.isDesktop &&
560-
this.settings.showBranchStatusBar
562+
this.settings.showBranchStatusBar &&
563+
!this.branchBar
561564
) {
562565
const branchStatusBarEl = this.addStatusBarItem();
563566
this.branchBar = new BranchStatusBar(

0 commit comments

Comments
 (0)