feat(ui): sort session history by last activity instead of creation time#1602
Conversation
6e78982 to
1fbf00d
Compare
There was a problem hiding this comment.
Pull request overview
This PR improves the session history sidebar by sorting sessions by their last activity time (updated_at) instead of creation time. This makes it easier to find active long-running sessions. The implementation includes proper grouping (Today/Yesterday/Older) and sorting (most recently active first) using the updated timestamp, with a fallback to created_at for backward compatibility.
Changes:
- Updated session grouping logic to use
updated_atinstead ofcreated_at - Updated session sorting within each group to use
updated_atin descending order - Modified ChatItem component to accept and display
updatedAttimestamp instead ofcreatedAt
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| ui/src/components/sidebars/GroupedChats.tsx | Updated grouping and sorting logic to use updated_at with fallback to created_at |
| ui/src/components/sidebars/SessionGroup.tsx | Updated prop passed to ChatItem from createdAt to updatedAt |
| ui/src/components/sidebars/ChatItem.tsx | Updated interface and display to use updatedAt instead of createdAt |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| const ChatItem = ({ sessionId, agentName, agentNamespace, onDelete, sessionName, onDownload, createdAt }: ChatItemProps) => { | ||
| const ChatItem = ({ sessionId, agentName, agentNamespace, onDelete, sessionName, onDownload, updatedAt }: ChatItemProps) => { |
There was a problem hiding this comment.
Note: The ChatItem component's prop has been changed from createdAt to updatedAt, but the Storybook stories file (ChatItem.stories.tsx) still references the old createdAt prop in 4 places (lines 65, 76, 87, and 110). This file will need to be updated separately to reflect the prop name change.
Signed-off-by: Raghavendiran-Github <raghavendiran46461@gmail.com>
1fbf00d to
b111e67
Compare
Summary
Closes #1556
Sessions in the history sidebar were sorted by creation time, making it hard to find active long-running sessions.
This change sorts by last activity (
updated_at) instead.updated_atso a session active today appears under "Today" evenif it was created days ago
updated_at— most recently active session appears firstcreated_atifupdated_atis not setFiles changed
ui/src/components/sidebars/GroupedChats.tsx— grouping and sort logicui/src/components/sidebars/SessionGroup.tsx— passupdatedAttoChatItemui/src/components/sidebars/ChatItem.tsx— displayupdatedAttimestamp