fix(app): session listing sorted by update time rather than id#17475
Open
neriousy wants to merge 2 commits intoanomalyco:devfrom
Open
fix(app): session listing sorted by update time rather than id#17475neriousy wants to merge 2 commits intoanomalyco:devfrom
neriousy wants to merge 2 commits intoanomalyco:devfrom
Conversation
Contributor
There was a problem hiding this comment.
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.
This was referenced Mar 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #17474
Type of change
What does this PR do?
Makes the session list sorted by
updated_atrather than idIf 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
If you do not follow this template your PR will be automatically rejected.