Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/contexts/GitStatusContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ interface GitStatusProviderProps {
* - Max 5 concurrent git status checks to prevent bash process explosion
*/
// Configuration - enabled by default, no env variables needed
const GIT_STATUS_INTERVAL_MS = 3000; // 3 seconds
const GIT_STATUS_INTERVAL_MS = 3000; // 3 seconds - interactive updates
const MAX_CONCURRENT_GIT_OPS = 5;

// Fetch configuration - aggressive intervals for fresh data
Expand Down
25 changes: 21 additions & 4 deletions src/hooks/useUnreadTracking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,14 @@ export function useUnreadTracking(
}, [selectedWorkspace?.workspaceId, workspaceStates, markAsRead]);

// Calculate unread status for all workspaces
const unreadStatusRef = useRef<Map<string, boolean>>(new Map());
const unreadStatus = useMemo(() => {
const result = new Map<string, boolean>();
const next = new Map<string, boolean>();

for (const [workspaceId, state] of workspaceStates) {
// Streaming workspaces are never unread
if (state.canInterrupt) {
result.set(workspaceId, false);
next.set(workspaceId, false);
continue;
}

Expand All @@ -92,10 +93,26 @@ export function useUnreadTracking(
msg.type !== "user" && msg.type !== "history-hidden" && (msg.timestamp ?? 0) > lastRead
);

result.set(workspaceId, hasUnread);
next.set(workspaceId, hasUnread);
}

return result;
// Return previous Map reference if nothing actually changed to keep identity stable
const prev = unreadStatusRef.current;
if (prev.size === next.size) {
let same = true;
for (const [k, v] of next) {
if (prev.get(k) !== v) {
same = false;
break;
}
}
if (same) {
return prev;
}
}

unreadStatusRef.current = next;
return next;
}, [workspaceStates, lastReadMap]);

// Manual toggle function for clicking the indicator
Expand Down