From cb93ed055b56122efbba2a0c719dd0798b598534 Mon Sep 17 00:00:00 2001 From: Alessandro <155005371+3clyp50@users.noreply.github.com> Date: Thu, 8 Oct 2026 00:37:29 +0200 Subject: [PATCH] Fix disappearing chats when Sidebar Folders is disabled Another plugin could import the disabled folders store, registering a replacement list view even though the folders UI was absent. This hid the standard chat and task lists while their data remained intact. Register view and sorting callbacks when each list extension mounts and remove them on unmount, preserving other plugins' callbacks. Reuse the existing component lifecycle hooks without adding work per chat or snapshot. Add regression coverage for indirect imports, filter cleanup, remounting, and preservation of other plugins' sorting. Document the lifecycle contract. Validation: frontend checks and 13 focused pytest tests passed. Live WebUI checks covered disable/re-enable, folder/flat switching, nested selection, and component unmount cleanup at localhost:32081. --- plugins/_sidebar_folders/AGENTS.md | 1 + .../sidebar-chats-list-view/folders.html | 3 +- .../sidebar-tasks-list-view/folders.html | 3 +- .../_sidebar_folders/tests/test_frontend.mjs | 34 ++++++++++++++++++- .../webui/sidebar-folders-store.js | 17 ++++++---- webui/components/sidebar/AGENTS.md | 1 + webui/components/sidebar/sidebar-store.js | 7 ++++ 7 files changed, 57 insertions(+), 9 deletions(-) diff --git a/plugins/_sidebar_folders/AGENTS.md b/plugins/_sidebar_folders/AGENTS.md index 3c8f90e56..e20913f99 100644 --- a/plugins/_sidebar_folders/AGENTS.md +++ b/plugins/_sidebar_folders/AGENTS.md @@ -40,6 +40,7 @@ - Sidebar menus share their pointer scope with the opening row or header. Dismiss after leaving both, allowing a short gap-crossing delay; also dismiss when focus leaves, the surrounding list scrolls, the window resizes, or the header extension unmounts. Mouse cleanup must not interrupt touch interaction or scrolling inside a menu. - Resolve the core row menu through its `rowActionsMenu` reference, not shared menu styling classes that community plugins may also use. Header integrations must preserve the core header and its `chats-header-controls` extension point. - The two list-view extension points are display-only alternatives. Disabling the plugin restores the core lists and existing chat/task controls. +- Register view and sorting callbacks when each list-view extension mounts, and unregister them when it unmounts. Importing the store from another plugin must not hide or filter the core lists while this plugin is disabled. ## Work Guidance diff --git a/plugins/_sidebar_folders/extensions/webui/sidebar-chats-list-view/folders.html b/plugins/_sidebar_folders/extensions/webui/sidebar-chats-list-view/folders.html index 85c705186..4f0d8c5f7 100644 --- a/plugins/_sidebar_folders/extensions/webui/sidebar-chats-list-view/folders.html +++ b/plugins/_sidebar_folders/extensions/webui/sidebar-chats-list-view/folders.html @@ -1,7 +1,8 @@ -