From 3c77402708cfc7e588cb720ae03ec50ce6141ede Mon Sep 17 00:00:00 2001 From: Ammar Date: Tue, 9 Dec 2025 12:37:22 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20fix:=20preserve=20review=20state?= =?UTF-8?q?=20when=20renaming=20workspaces?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. Moved getReviewStateKey to storage.ts and added it to the migration list. _Generated with mux_ --- src/browser/hooks/useReviewState.ts | 8 +------- src/common/constants/storage.ts | 10 ++++++++++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/browser/hooks/useReviewState.ts b/src/browser/hooks/useReviewState.ts index 91f82faeda..8162970376 100644 --- a/src/browser/hooks/useReviewState.ts +++ b/src/browser/hooks/useReviewState.ts @@ -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 diff --git a/src/common/constants/storage.ts b/src/common/constants/storage.ts index d2f995af26..426aa880ed 100644 --- a/src/common/constants/storage.ts +++ b/src/common/constants/storage.ts @@ -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 @@ -278,6 +287,7 @@ const PERSISTENT_WORKSPACE_KEY_FUNCTIONS: Array<(workspaceId: string) => string> getThinkingLevelKey, getAutoRetryKey, getRetryStateKey, + getReviewStateKey, getReviewExpandStateKey, getFileTreeExpandStateKey, getReviewSearchStateKey,