Repository navigation
feat(sidebar): add open and close methods for sidebar app management - #2969
codewithchai0605 wants to merge 2 commits into
Conversation
|
|
Why do we need separate open and close APIs? Isn't |
|
@bajrangCoder |
| vi.resetModules(); | ||
| localStorage.clear(); | ||
| instances.length = 0; | ||
| sidebarApps = (await import("../../src/sidebarApps/index.js")).default; |
There was a problem hiding this comment.
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.
| setActiveApp(id); | ||
| } | ||
|
|
||
| Sidebar.show(); |
There was a problem hiding this comment.
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).
Add public api to open and close sidebar from the plugin.