feat(web): add collapsible session sidebar - #1747
Conversation
There was a problem hiding this comment.
Findings
- [Major] Compact mode bypasses the session preview cap and mounts the full session history (
web/src/components/SessionList.tsx:1604). - [Minor] Search/date/unread filters remain active after their controls are hidden (
web/src/components/SessionList.tsx:1792).
Summary
Review mode: initial
Two issues found in the compact session-list path. No questions required.
Testing
Not run (automation): executing PR code is disallowed for this review. GitHub integration check passed; the main test workflow was pending at review time. Missing coverage: compact preview limits/expansion and collapsing while transient filters are active.
HAPI Bot
| const renderDirectoryGroup = (group: SessionGroup) => { | ||
| const isCollapsed = isGroupCollapsed(group) | ||
| const visibleGroupSessions = getVisibleGroupSessions(group) | ||
| const visibleGroupSessions = compact ? group.sessions : getVisibleGroupSessions(group) |
There was a problem hiding this comment.
[MAJOR] Compact mode bypasses the preview cap
compact ? group.sessions : ... mounts every session in every directory instead of using the configured preview limit. Collapsed panels still retain their children, and /api/sessions has no default result limit, so a long-lived installation can turn one sidebar-collapse click into hundreds or thousands of SessionItem trees/hooks and stall the page.
Suggested fix: keep the existing preview helper in compact mode and expose an icon-only expansion affordance for hidden rows.
const visibleGroupSessions = getVisibleGroupSessions(group)
{compact && hiddenSessionCount > 0 ? (
<button
type="button"
onClick={() => showMoreSessions(group)}
aria-label={t("sessions.group.expand", { n: expandCount })}
>
<SessionPreviewArrowIcon direction="down" className="h-3 w-3" />
</button>
) : null}| // it cannot suppress header actions (or re-expand on its own when sessions | ||
| // return) while no search control is rendered. | ||
| const showSearch = props.sessions.length > 0 | ||
| const showSearch = !compact && props.sessions.length > 0 |
There was a problem hiding this comment.
[MINOR] Hidden filters keep filtering the compact rail
Changing showSearch to false only unmounts the controls. searchQuery, the custom date range, and showUnreadOnly still feed visibleSessions, so collapsing after a search/date/unread selection can produce a silently incomplete or empty rail with no visible way to understand or clear the filter until the user expands again.
Suggested fix: ignore transient filters while compact, preserving their state for when the sidebar is expanded again.
const isFiltering = !compact && (normalizedQuery.length > 0 || timeRange !== null)
const unreadFilteredSessions = useMemo(() => {
if (compact || !showUnreadOnly) return visibleSessions
// existing unread filtering
}, [compact, lastSeenVersion, visibleSessions, selectedSessionId, showUnreadOnly])
Summary
Testing
bun typecheckbun run test