Skip to content

fix(app): fix session list sorting by id rather than updated time#17848

Open
Rohansguliani wants to merge 1 commit intoanomalyco:devfrom
Rohansguliani:fix-session-sort
Open

fix(app): fix session list sorting by id rather than updated time#17848
Rohansguliani wants to merge 1 commit intoanomalyco:devfrom
Rohansguliani:fix-session-sort

Conversation

@Rohansguliani
Copy link
Copy Markdown

Issue for this PR

Closes #17474

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Fixes a bug where the session list is sorted by ID rather than updated time, leading to older sessions randomly appearing at the top until "Load More" is clicked.

The root cause was trimSessions in the local cache sorting sessions ascending (oldest-first) instead of newest-first before slicing. This PR updates trimSessions to properly keep the most recent sessions. It also fixes the 60-second fallback sorting logic in helpers.ts so active sessions appear at the top chronologically.

How did you verify your code works?

Tested the changes locally by building the frontend and running the backend server via Tailscale. Verified that new and updated sessions properly surface to the top of the sidebar. Also fixed and ran the unit tests in event-reducer.test.ts to assert session.created behaves as expected with trimming.

Screenshots / recordings

@Rohansguliani - Please attach a screen recording to this PR to satisfy the UI changes compliance rule!

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions
Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential Duplicate Found:

Why it's related:
This PR appears to be addressing the same issue as the current PR #17848. Both are fixing the session list sorting problem where sessions were being sorted by ID instead of updated time. PR #17475 seems to be the prior or related fix for the same bug described in issue #17474.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

App: session list sorted by id rather than updated time

1 participant