feat(workspace): add last_user_message_at field for better activity tracking#2181
feat(workspace): add last_user_message_at field for better activity tracking#2181jonathanlab wants to merge 1 commit into
Conversation
…racking Generated-By: PostHog Code Task-Id: bd0d1144-27e7-4128-8a7a-13f8fa183458
|
| return { | ||
| timestamps, | ||
| isLoading, | ||
| markAsViewed, | ||
| markActivity, | ||
| getLastViewedAt, | ||
| getLastActivityAt, | ||
| markAsViewed: markViewedMutation.mutate, | ||
| markActivity: markActivityMutation.mutate, | ||
| markUserSend: markUserSendMutation.mutate, | ||
| }; |
There was a problem hiding this comment.
The
markActivity return value is now dead code — no caller destructures it from useTaskViewed(). All usages in React components (useSessionCallbacks, SidebarMenu, CommandCenterView, useTaskDeepLink) destructure only markAsViewed, markUserSend, or timestamps. The only live path for markActivity is taskViewedApi.markActivity (the non-React imperative API), which is unrelated to this hook return. Removing it keeps the API surface aligned with simplicity rule 4.
| return { | |
| timestamps, | |
| isLoading, | |
| markAsViewed, | |
| markActivity, | |
| getLastViewedAt, | |
| getLastActivityAt, | |
| markAsViewed: markViewedMutation.mutate, | |
| markActivity: markActivityMutation.mutate, | |
| markUserSend: markUserSendMutation.mutate, | |
| }; | |
| return { | |
| timestamps, | |
| isLoading, | |
| markAsViewed: markViewedMutation.mutate, | |
| markUserSend: markUserSendMutation.mutate, | |
| }; |
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/code/src/renderer/features/sidebar/hooks/useTaskViewed.ts
Line: 117-123
Comment:
The `markActivity` return value is now dead code — no caller destructures it from `useTaskViewed()`. All usages in React components (`useSessionCallbacks`, `SidebarMenu`, `CommandCenterView`, `useTaskDeepLink`) destructure only `markAsViewed`, `markUserSend`, or `timestamps`. The only live path for `markActivity` is `taskViewedApi.markActivity` (the non-React imperative API), which is unrelated to this hook return. Removing it keeps the API surface aligned with simplicity rule 4.
```suggestion
return {
timestamps,
isLoading,
markAsViewed: markViewedMutation.mutate,
markUserSend: markUserSendMutation.mutate,
};
```
How can I resolve this? If you propose a fix, please make it concise.
Context: previously we'd based the chronological list on a bunch of stuff:
this felt quite inconsistent, and there were some bugs with old threads moving up in the chronological sort if you opened them without doing anything.
let's simplify!
Added a new
last_user_message_atcolumn to theworkspacestable to track when users last sent messages, enabling proper sorting in the sidebar. Existing data is migrated from thelast_activity_atcolumn.Created with PostHog Code