Skip to content

fix(app): session listing sorted by update time rather than id#17475

Open
neriousy wants to merge 2 commits intoanomalyco:devfrom
neriousy:fix/proper-session-listing
Open

fix(app): session listing sorted by update time rather than id#17475
neriousy wants to merge 2 commits intoanomalyco:devfrom
neriousy:fix/proper-session-listing

Conversation

@neriousy
Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #17474

Type of change

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

What does this PR do?

Makes the session list sorted by updated_at rather than id

If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!

How did you verify your code works?

Load sessions -> load more

Screenshots / recordings

If this is a UI change, please include a screenshot or recording.

Checklist

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

If you do not follow this template your PR will be automatically rejected.

@neriousy neriousy requested a review from adamdotdevin as a code owner March 14, 2026 11:36
Copilot AI review requested due to automatic review settings March 14, 2026 11:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes session list ordering by removing client-side sorting by id and instead preserving/maintaining “most recently updated” ordering (as provided by the server and reinforced by client upsert logic).

Changes:

  • Stop re-sorting fetched session lists by id, preserving server-provided order.
  • Update session upsert/update paths to maintain recency ordering (updated time, then id as tiebreak).
  • Adjust and add tests to reflect the new ordering behavior.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/app/src/pages/layout/helpers.ts Removes time-window/id-based sorting for root session lists; latest-session selection now sorts by updated time.
packages/app/src/pages/layout/helpers.test.ts Updates tests for latest session selection; adds coverage for preserving store ordering of visible roots.
packages/app/src/pages/layout.tsx Replaces binary-search deletion with linear lookup; updates latestRootSession call signature.
packages/app/src/context/sync.tsx Removes id-sorting on fetch and replaces binary search usage on sessions with linear lookups + recency-aware insertion for roots.
packages/app/src/context/notification.tsx Replaces binary-search session lookup with .find().
packages/app/src/context/global-sync/session-trim.ts Stops reshaping lists by id; trims/dedupes while preserving fetched order and uses recency comparator utilities.
packages/app/src/context/global-sync/session-trim.test.ts Updates expectations to match preserved fetched order and new root/child ordering.
packages/app/src/context/global-sync/event-reducer.ts Adds recency-aware upsert logic for sessions and removes Binary.search dependency for session arrays.
packages/app/src/context/global-sync.tsx Stops sorting fetched sessions by id before trimming/reconciling.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

App: session list sorted by id rather than updated time

2 participants