fix: apply getVisibleSessions filter in renderSheetList for mobile bottom sheet

Hidden sessions were still appearing in the mobile bottom-sheet session
switcher because renderSheetList() read _currentSessions directly,
bypassing the getVisibleSessions() helper used by renderGrid() and
renderSidebar().

- app.js: sortByPriority now receives getVisibleSessions(_currentSessions)
  instead of _currentSessions directly in renderSheetList()
- test_frontend_js.py: add test_render_sheet_list_filters_hidden_sessions
  to assert getVisibleSessions is called in renderSheetList body

Completes consistent hidden-sessions filtering across all three render
paths (grid, sidebar, mobile bottom sheet).

Co-authored-by: Amplifier <amplifier@amplified.dev>
This commit is contained in:
Brian Krabach
2026-03-30 02:49:41 -07:00
parent d2f3b43759
commit bac23f26dc
2 changed files with 19 additions and 1 deletions
+1 -1
View File
@@ -1261,7 +1261,7 @@ function closeBottomSheet() {
function renderSheetList() { function renderSheetList() {
var list = $('sheet-list'); var list = $('sheet-list');
if (!list) return; if (!list) return;
var sorted = sortByPriority(_currentSessions); var sorted = sortByPriority(getVisibleSessions(_currentSessions));
list.innerHTML = sorted.map(function(s) { list.innerHTML = sorted.map(function(s) {
var hasBell = s.bell && s.bell.unseen_count > 0 && var hasBell = s.bell && s.bell.unseen_count > 0 &&
(s.bell.seen_at === null || s.bell.last_fired_at > s.bell.seen_at); (s.bell.seen_at === null || s.bell.last_fired_at > s.bell.seen_at);
+18
View File
@@ -2263,6 +2263,24 @@ def test_render_sidebar_uses_visible_array() -> None:
) )
# ── app.js: renderSheetList filters hidden sessions ───────────────────────────
def test_render_sheet_list_filters_hidden_sessions() -> None:
"""renderSheetList() must filter out hidden sessions via getVisibleSessions()."""
match = re.search(
r"function renderSheetList\s*\(\)\s*\{(.*?)(?=\n(?:function|//|window\.))",
_JS,
re.DOTALL,
)
assert match, "renderSheetList function not found in app.js"
body = match.group(1)
assert "getVisibleSessions" in body, (
"renderSheetList must call getVisibleSessions() to filter hidden sessions; "
"currently it reads _currentSessions directly and bypasses the filter"
)
# ── app.js: DOMContentLoaded calls loadServerSettings ──────────────────────── # ── app.js: DOMContentLoaded calls loadServerSettings ────────────────────────