Skip to content

Commit a8ffe35

Browse files
authored
🤖 fix: preserve review state when renaming workspaces (#1044)
The `getReviewStateKey` function was defined locally in `useReviewState.ts` but not included in `PERSISTENT_WORKSPACE_KEY_FUNCTIONS`, so review state (which hunks were marked as read) was not migrated during workspace rename. **Fix:** Moved `getReviewStateKey` to `storage.ts` and added it to the migration list. _Generated with `mux`_
1 parent 2696839 commit a8ffe35

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/browser/hooks/useReviewState.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,13 @@
66
import { useCallback, useMemo, useEffect, useState } from "react";
77
import { usePersistedState } from "./usePersistedState";
88
import type { ReviewState, HunkReadState } from "@/common/types/review";
9+
import { getReviewStateKey } from "@/common/constants/storage";
910

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

15-
/**
16-
* Get the localStorage key for review state
17-
*/
18-
function getReviewStateKey(workspaceId: string): string {
19-
return `review-state:${workspaceId}`;
20-
}
21-
2216
/**
2317
* Evict oldest read states if count exceeds max
2418
* Keeps the newest MAX_READ_STATES entries

src/common/constants/storage.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,15 @@ export const DEFAULT_TUTORIAL_STATE: TutorialState = {
192192
completed: {},
193193
};
194194

195+
/**
196+
* Get the localStorage key for review (hunk read) state per workspace
197+
* Stores which hunks have been marked as read during code review
198+
* Format: "review-state:{workspaceId}"
199+
*/
200+
export function getReviewStateKey(workspaceId: string): string {
201+
return `review-state:${workspaceId}`;
202+
}
203+
195204
/**
196205
* Get the localStorage key for hunk expand/collapse state in Review tab
197206
* Stores user's manual expand/collapse preferences per hunk
@@ -276,6 +285,7 @@ const PERSISTENT_WORKSPACE_KEY_FUNCTIONS: Array<(workspaceId: string) => string>
276285
getThinkingLevelKey,
277286
getAutoRetryKey,
278287
getRetryStateKey,
288+
getReviewStateKey,
279289
getReviewExpandStateKey,
280290
getFileTreeExpandStateKey,
281291
getReviewSearchStateKey,

0 commit comments

Comments
 (0)