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
8 changes: 1 addition & 7 deletions src/browser/hooks/useReviewState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,13 @@
import { useCallback, useMemo, useEffect, useState } from "react";
import { usePersistedState } from "./usePersistedState";
import type { ReviewState, HunkReadState } from "@/common/types/review";
import { getReviewStateKey } from "@/common/constants/storage";

/**
* Maximum number of read states to keep per workspace (LRU eviction)
*/
const MAX_READ_STATES = 1024;

/**
* Get the localStorage key for review state
*/
function getReviewStateKey(workspaceId: string): string {
return `review-state:${workspaceId}`;
}

/**
* Evict oldest read states if count exceeds max
* Keeps the newest MAX_READ_STATES entries
Expand Down
10 changes: 10 additions & 0 deletions src/common/constants/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,15 @@ export const DEFAULT_TUTORIAL_STATE: TutorialState = {
completed: {},
};

/**
* Get the localStorage key for review (hunk read) state per workspace
* Stores which hunks have been marked as read during code review
* Format: "review-state:{workspaceId}"
*/
export function getReviewStateKey(workspaceId: string): string {
return `review-state:${workspaceId}`;
}

/**
* Get the localStorage key for hunk expand/collapse state in Review tab
* Stores user's manual expand/collapse preferences per hunk
Expand Down Expand Up @@ -278,6 +287,7 @@ const PERSISTENT_WORKSPACE_KEY_FUNCTIONS: Array<(workspaceId: string) => string>
getThinkingLevelKey,
getAutoRetryKey,
getRetryStateKey,
getReviewStateKey,
getReviewExpandStateKey,
getFileTreeExpandStateKey,
getReviewSearchStateKey,
Expand Down