feat(sidebar): replace binary source tabs with multi-select origin filter (#3418)#3566
feat(sidebar): replace binary source tabs with multi-select origin filter (#3418)#3566rodboev wants to merge 2 commits into
Conversation
|
| Filename | Overview |
|---|---|
| static/sessions.js | Replaces string-based source filter with a Set-based multi-select origin filter and inlines _partitionSidebarSessionRows; introduces a crash: archivedCount is used but never declared in the refactored code, and _hydrateTodosFromSession was accidentally removed from newSession(). |
| static/style.css | Adds CSS for .session-filter-bar, .session-origin-popover and related selectors; keeps deprecated .session-source-tabs styles for cache-busted clients. No issues. |
| tests/test_active_empty_session_sidebar.py | Updates test assertion from string-based filter reset to Set-based initialization check. Straightforward update, no issues. |
| tests/test_issue2351_cli_session_source_filter.py | Updates static-string assertions to match new variable names and popover structure. No issues. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[renderSessionListFromCache] --> B[allMatched: ensureActiveSessionRowPresent]
B --> C[withMessages: filter by message/activity state]
C --> D1[webuiSessionCount]
C --> D2[cliSessionCount]
C --> E[sourceFiltered: filter by _activeOriginFilters Set]
E --> F[profileFiltered: exclude default_hidden]
F --> G[projectFiltered: filter by _activeProject]
G --> H[sessionsRaw: filter archived]
H --> I[sessions: collapse lineage + attach children]
I --> J[Render session rows]
G --> K[archivedCount UNDEFINED]
K --> L[Show/hide archived toggle]
Comments Outside Diff (1)
-
static/sessions.js, line 4857-4860 (link)archivedCountis never declared in the refactored codeThe old
_partitionSidebarSessionRowsfunction computedarchivedCountand returned it in its result object. That function was deleted and its logic was inlined intorenderSessionListFromCache, but thearchivedCountaccumulation was not ported over. Accessing an undeclared variable throwsReferenceError: archivedCount is not definedon every call torenderSessionListFromCache, making the entire sidebar non-functional.The fix is to add
const archivedCount = projectFiltered.filter(s => s.archived).length;afterprojectFilteredis computed.
Reviews (3): Last reviewed commit: "fix(sidebar): prevent popover close on c..." | Re-trigger Greptile
ed27a78 to
bae58df
Compare
Thinking Path
_sessionSourceFilter) that could hold only'webui'or'cli'.Setrather than a string.What Changed
static/sessions.js: replaced_sessionSourceFilterstring with_activeOriginFiltersSet; replaced_setSessionSourceFilter/_restoreSessionSourceFilterwith_toggleOriginFilter/_restoreOriginFilters; replaced two-tab renderer with a funnel-button popover that lists origin checkboxes; updated localStorage key tohermes-origin-filters; updated new-session reset and CLI empty-state guard; origin normalization maps all CLI-class sessions to'cli'unconditionally.static/style.css: added.session-filter-bar,.session-origin-popover,.session-origin-checkbox,.session-origin-countstyles; kept old.session-source-tabsselectors with a deprecation comment for cache-busted clients.tests/test_issue2351_cli_session_source_filter.py: updated string assertions to match the new state variable and popover structure.tests/test_active_empty_session_sidebar.py: updated the new-session test to verify Set-based initialization.Why It Matters
Users with mixed-origin setups can now view sessions from multiple origins simultaneously or filter to any subset, instead of flipping between two mutually exclusive views.
Verification
Risks / Follow-ups
show_cli_sessionsandshow_previous_messaging_sessionsis deferred to avoid breaking existing installs; only the Settings UI toggles are relocated.Model Used
Claude Opus 4.8 via Claude Code CLI
Closes #3418