App mode: keep an open RigShare or Files panel when entering the App view

ComfyUI closes the side panel when a tab enters the App view; reopen the
RigShare tab that was open, so it behaves the same in both directions.
This commit is contained in:
Edouard Durand
2026-09-26 07:17:49 +00:00
parent 5e943f3e60
commit 7e10db82df
2 changed files with 32 additions and 0 deletions
+6
View File
@@ -1,5 +1,11 @@
# Changelog
## Unreleased
### Fixed
- Entering the App view closed an open RigShare or Files panel (going back to the graph kept it open). It now stays open both ways
## 1.2.1 (2026-09-26)
### Changed
+26
View File
@@ -33,6 +33,9 @@ export class AppDock {
}));
this.dock.style.display = "none";
document.body.append(this.dock);
this.wasApp = false;
this.graphTab = null; // our tab open in the graph view, if any
this.restore = null; // { tabId, until }: reopen it after entering the App view
setInterval(() => this.update(), 300);
}
@@ -48,6 +51,7 @@ export class AppDock {
update() {
const active = this.sync.inAppMode;
this.keepOpenIntoApp(active);
const rail = active ? document.querySelector(RAIL) : null;
if (rail) this.addToRail(rail);
else this.removeFromRail();
@@ -55,6 +59,28 @@ export class AppDock {
this.refreshButtons();
}
/**
* ComfyUI closes the side panel when a tab enters the App view (not when it
* goes back to the graph). If a RigShare tab was open, open it again.
*/
keepOpenIntoApp(inApp) {
const open = this.activeTabId;
const ours = Object.values(this.views).map((v) => v.tabId);
if (!inApp) {
this.graphTab = ours.includes(open) ? open : null;
this.restore = null;
} else if (!this.wasApp && this.graphTab) {
this.restore = { tabId: this.graphTab, until: Date.now() + 1500 };
}
this.wasApp = inApp;
if (!this.restore) return;
if (open === this.restore.tabId || Date.now() > this.restore.until) {
this.restore = null;
} else if (open === null) {
this.app.extensionManager?.command?.execute(`Workspace.ToggleSidebarTab.${this.restore.tabId}`);
}
}
/** Copy one of ComfyUI's sidebar buttons for each view, placed after its own tabs. */
addToRail(rail) {
const ours = Object.values(this.railButtons);