fix(web): make the diff layout toggle a persisted setting (#9326)
Co-authored-by: Claude Code <[email protected]>
This commit is contained in:
1 parent
12f1fc427e
commit
9409dd20a9
9 files changed
+83
-48
No files matched your search
@@ -10,16 +10,12 @@ export type DiffPanelSelection =
|
||||
| { kind: "unstaged" }
|
||||
| { kind: "turn"; turnId: TurnId; filePath: string | null; revealRequestId: number };
|
||||
|
||||
export type DiffRenderMode = "stacked" | "split";
|
||||
|
||||
const DEFAULT_SELECTION: DiffPanelSelection = { kind: "branch", baseRef: null };
|
||||
const DEFAULT_WORKING_TREE_SELECTION: DiffPanelSelection = { kind: "unstaged" };
|
||||
|
||||
interface DiffPanelStoreState {
|
||||
byThreadKey: Record<string, DiffPanelSelection>;
|
||||
branchBaseRefByThreadKey: Record<string, string | null>;
|
||||
diffRenderMode: DiffRenderMode;
|
||||
setDiffRenderMode: (mode: DiffRenderMode) => void;
|
||||
selectGitScope: (ref: ScopedThreadRef, scope: "branch" | "unstaged") => void;
|
||||
selectBranchBaseRef: (ref: ScopedThreadRef, baseRef: string | null) => void;
|
||||
selectTurn: (ref: ScopedThreadRef, turnId: TurnId, filePath?: string) => void;
|
||||
@@ -37,8 +33,6 @@ export const useDiffPanelStore = create<DiffPanelStoreState>()(
|
||||
(set) => ({
|
||||
byThreadKey: {},
|
||||
branchBaseRefByThreadKey: {},
|
||||
diffRenderMode: "stacked",
|
||||
setDiffRenderMode: (diffRenderMode) => set({ diffRenderMode }),
|
||||
selectGitScope: (ref, scope) =>
|
||||
set((state) => {
|
||||
const threadKey = scopedThreadKey(ref);
|
||||
@@ -132,7 +126,6 @@ export const useDiffPanelStore = create<DiffPanelStoreState>()(
|
||||
partialize: (state) => ({
|
||||
byThreadKey: state.byThreadKey,
|
||||
branchBaseRefByThreadKey: state.branchBaseRefByThreadKey,
|
||||
diffRenderMode: state.diffRenderMode,
|
||||
}),
|
||||
},
|
||||
),
|
||||
|
||||
Reference in new issue
Block a user