fix(web): keep project pin inside groups below In progress (#1458)

* fix(web): keep project pin inside groups below In progress

Revert #1432's section lift: Pin in project stays first inside its
folder and among directory groups, but must not promote whole folders
above In progress. Restore Settings copy to match.

Fixes #1457

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(web): align pin-in-progress Settings copy with exclusions

Describe unpinned floaters only, keep global pins above In progress,
and avoid implying every working session or project-pin folders float.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
HeavyGee
2026-08-09 12:45:01 +01:00
committed by GitHub
co-authored by Cursor
parent 00b6e44869
commit b8a765d4ef
4 changed files with 20 additions and 22 deletions
@@ -496,7 +496,7 @@ describe('SessionList collapse behavior', () => {
expect(screen.getByRole('button', { name: /Pinned running task/ })).toBeInTheDocument()
})
it('renders project-pin groups above In progress when pin-in-progress is on', () => {
it('keeps In progress above project-pin groups; project pin stays first inside its group', () => {
localStorage.setItem('hapi-pin-in-progress-sessions', 'true')
const sessions = [
makeSession({
@@ -508,9 +508,14 @@ describe('SessionList collapse behavior', () => {
makeSession({
id: 'session-project-pin',
pinned: true,
updatedAt: 200,
updatedAt: 100,
metadata: { path: '/work/pinned-project', name: 'Project pin', flavor: 'codex' },
}),
makeSession({
id: 'session-project-idle',
updatedAt: 200,
metadata: { path: '/work/pinned-project', name: 'Project idle', flavor: 'codex' },
}),
makeSession({
id: 'session-floater',
active: true,
@@ -527,14 +532,19 @@ describe('SessionList collapse behavior', () => {
render(renderSessionList(sessions, null))
const globalSection = screen.getByTitle('Pinned sessions')
const projectPinGroup = screen.getByTitle('/work/pinned-project')
const inProgress = screen.getByTitle('In progress')
const projectPinGroup = screen.getByTitle('/work/pinned-project')
const otherGroup = screen.getByTitle('/work/other')
const projectPinRow = screen.getByRole('button', { name: /Project pin/ })
const projectIdleRow = screen.getByRole('button', { name: /Project idle/ })
expect(globalSection).toAppearBefore(projectPinGroup)
expect(projectPinGroup).toAppearBefore(inProgress)
expect(inProgress).toAppearBefore(otherGroup)
expect(screen.getByRole('button', { name: /Project pin/ })).toBeInTheDocument()
// Section order: global pin band → In progress → directory groups
// (project-pin groups may sort first among groups, but never above In progress).
expect(globalSection).toAppearBefore(inProgress)
expect(inProgress).toAppearBefore(projectPinGroup)
expect(projectPinGroup).toAppearBefore(otherGroup)
// Intra-group: project pin stays first inside its folder.
expect(projectPinRow).toAppearBefore(projectIdleRow)
expect(screen.getByRole('button', { name: /Unpinned floater/ })).toBeInTheDocument()
})
+1 -13
View File
@@ -1283,16 +1283,6 @@ export function SessionList(props: {
),
[machineFilteredSessions, pinInProgressSessions]
)
// Durable project pins beat ephemeral In progress floaters: pin-containing
// groups render above the running section; unpinned groups stay below.
const pinnedProjectGroups = useMemo(
() => groups.filter((group) => group.hasPinnedSession),
[groups]
)
const otherProjectGroups = useMemo(
() => groups.filter((group) => !group.hasPinnedSession),
[groups]
)
const [collapseOverrides, setCollapseOverrides] = useState<Map<string, boolean>>(
() => new Map()
)
@@ -1821,8 +1811,6 @@ export function SessionList(props: {
</div>
) : null}
{pinnedProjectGroups.map(renderDirectoryGroup)}
{runningSessionTotal > 0 ? (
<div key="running-section">
<div
@@ -1886,7 +1874,7 @@ export function SessionList(props: {
</div>
</div>
) : null}
{otherProjectGroups.map(renderDirectoryGroup)}
{groups.map(renderDirectoryGroup)}
</div>
</div>
</div>