State of panel not changing on panel.show or panel.hide


#1

I have been developing a package and I have noticed when I attempt to hide the panel it doesn’t actually change.

Toggle code:

toggle() {
    console.log('toggling', this.panel.isVisible());
    this.panel.isVisible() ? this.panel.hide() : this.panel.show();
    console.log('toggled?', this.panel.isVisible());
}

To check:

this.panel.onDidChangeVisible(() => {
      console.log('actual toggle', this.panel.isVisible());
   });

On package load, it does show up properly because I am directly using atom.workspace.open(this.view).
At load the console reads:

toggling true
actual toggle false
toggled? false
actual toggle true

On the second toggle, the panel remains and the console reads:

toggling true
actual toggle false
toggled? false