Skip to content

feat(sidebar): add open and close methods for sidebar app management - #2969

Open
codewithchai0605 wants to merge 2 commits into
Acode-Foundation:mainfrom
codewithchai0605:feat/sidebar-app-plugin-controls
Open

codewithchai0605 wants to merge 2 commits into
Acode-Foundation:mainfrom
codewithchai0605:feat/sidebar-app-plugin-controls

Conversation

@codewithchai0605

Copy link
Copy Markdown

Add public api to open and close sidebar from the plugin.

@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the wide-screen close issue is fixed.

Summary

Adds plugin-facing open() and close() methods for sidebar apps.

  • Plugins can open the sidebar with a chosen app or close it.

Reviews (2) · Last reviewed commit: "feat(sidebar): update hide method to acc..." · Reviewed by Greptile

Comment thread src/sidebarApps/index.js Outdated
@codewithchai0605

Copy link
Copy Markdown
Author

@greptile

@bajrangCoder

bajrangCoder commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Why do we need separate open and close APIs?

Isn't toggle-sidebar command is enough? just call it using : acode.exec("toggle-sidebar");

@codewithchai0605

Copy link
Copy Markdown
Author

@bajrangCoder toggle-sidebar is good, but it only opens the sidebar and last opened sidebar apps. This change will allow the plugin to open a particular sidebarApp, not the last opened.
Ofcourse plugin developer can open the particular sidebarApp by doing localStorage.setItem("sidebarAppsLastSection", sidebarAppId) and then they can call toggle-sidebar. But I think this is a cleaner way to do so, that why I added this features. If not so useful then, I can close it.

vi.resetModules();
localStorage.clear();
instances.length = 0;
sidebarApps = (await import("../../src/sidebarApps/index.js")).default;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All 4 tests here fail before any assertion runs: importing src/sidebarApps/index.js throws RolldownError: Parse failure at the sponsor <span ...> JSX (line 107), because the vitest config doesn't transform JSX in .js files. This is why the "Unit Tests (On PR Only)" check is red (1 failed / 88 passed).

The module needs a JSX transform in vitest (or the JSX needs to be avoided or mocked out in this import path) before these tests check anything.

Comment thread src/sidebarApps/index.js
setActiveApp(id);
}

Sidebar.show();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sidebar.show() doesn't check whether the sidebar is already open. On phone, every call does actionStack.push({ id: "sidebar", ... }), and actionStack.remove only removes one match.

So if a plugin calls open("myApp") to switch apps while the sidebar is already showing, the stack ends up with two sidebar entries. The first Back closes the sidebar. The second Back runs hideMaster on a sidebar that's already hidden: the press is swallowed, and the hide listeners fire again.

openWithSearch already had this behaviour, but as a public plugin API it's much easier to hit. Suggestion: if the sidebar is already activated, just switch the app and skip Sidebar.show() (or make show() do nothing when $el.activated is set).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

3 participants