feat(web): add stepwise session preview controls (#1266)

* feat(web): add stepwise session preview controls

* fix(web): avoid no-op session preview collapse

* fix(web): expand previews from rendered count
This commit is contained in:
Ananovo
2026-07-31 16:08:27 +08:00
committed by GitHub
parent b3a1f5fafd
commit 0db7d68b37
5 changed files with 212 additions and 32 deletions
+17
View File
@@ -6,6 +6,7 @@ import {
filterActiveSessionsOnly,
getSessionTimeRange,
getNextSessionVisibleCount,
getPreviousSessionVisibleCount,
getSessionDedupKey,
getWorktreeSessionLabel,
getVisibleSessionPreview,
@@ -428,6 +429,22 @@ describe('getNextSessionVisibleCount', () => {
})
})
describe('getPreviousSessionVisibleCount', () => {
it('collapses one batch of step size per call', () => {
expect(getPreviousSessionVisibleCount(20, 8)).toBe(12)
expect(getPreviousSessionVisibleCount(12, 8)).toBe(8)
})
it('never goes below the preview limit', () => {
expect(getPreviousSessionVisibleCount(10, 8)).toBe(8)
expect(getPreviousSessionVisibleCount(8, 8)).toBe(8)
})
it('uses a minimum batch size of one', () => {
expect(getPreviousSessionVisibleCount(5, 0)).toBe(4)
})
})
describe('expandSelectedSessionCollapseOverrides', () => {
it('expands the collapsed project group, but preserves session preview folding', () => {
const overrides = new Map<string, boolean>([