History

fix(web): persist diff view mode (#5731)

Leonel Rivas committed 3 months agov0.0.33-nightly.20260808.1038

Commit 89ee6921 parent a20923c3 files · +36 −3Browse files

Showing the changes to apps/web/src/diffPanelStore.ts (1 of 3 files). Show all

Unified · Split

apps/web/src/diffPanelStore.ts+7−0
@@ -10,12 +10,16 @@ export type DiffPanelSelection = · 9 unmodified lines
10 | { kind: "unstaged" }10 | { kind: "unstaged" }
11 | { kind: "turn"; turnId: TurnId; filePath: string | null; revealRequestId: number };11 | { kind: "turn"; turnId: TurnId; filePath: string | null; revealRequestId: number };
12 12
13export type DiffRenderMode = "stacked" | "split";
14
13const DEFAULT_SELECTION: DiffPanelSelection = { kind: "branch", baseRef: null };15const DEFAULT_SELECTION: DiffPanelSelection = { kind: "branch", baseRef: null };
14const DEFAULT_WORKING_TREE_SELECTION: DiffPanelSelection = { kind: "unstaged" };16const DEFAULT_WORKING_TREE_SELECTION: DiffPanelSelection = { kind: "unstaged" };
15 17
16interface DiffPanelStoreState {18interface DiffPanelStoreState {
17 byThreadKey: Record<string, DiffPanelSelection>;19 byThreadKey: Record<string, DiffPanelSelection>;
18 branchBaseRefByThreadKey: Record<string, string | null>;20 branchBaseRefByThreadKey: Record<string, string | null>;
21 diffRenderMode: DiffRenderMode;
22 setDiffRenderMode: (mode: DiffRenderMode) => void;
19 selectGitScope: (ref: ScopedThreadRef, scope: "branch" | "unstaged") => void;23 selectGitScope: (ref: ScopedThreadRef, scope: "branch" | "unstaged") => void;
20 selectBranchBaseRef: (ref: ScopedThreadRef, baseRef: string | null) => void;24 selectBranchBaseRef: (ref: ScopedThreadRef, baseRef: string | null) => void;
21 selectTurn: (ref: ScopedThreadRef, turnId: TurnId, filePath?: string) => void;25 selectTurn: (ref: ScopedThreadRef, turnId: TurnId, filePath?: string) => void;
@@ -33,6 +37,8 @@ export const useDiffPanelStore = create<DiffPanelStoreState>()( · 11 unmodified lines
33 (set) => ({37 (set) => ({
34 byThreadKey: {},38 byThreadKey: {},
35 branchBaseRefByThreadKey: {},39 branchBaseRefByThreadKey: {},
40 diffRenderMode: "stacked",
41 setDiffRenderMode: (diffRenderMode) => set({ diffRenderMode }),
36 selectGitScope: (ref, scope) =>42 selectGitScope: (ref, scope) =>
37 set((state) => {43 set((state) => {
38 const threadKey = scopedThreadKey(ref);44 const threadKey = scopedThreadKey(ref);
@@ -126,6 +132,7 @@ export const useDiffPanelStore = create<DiffPanelStoreState>()( · 87 unmodified lines
126 partialize: (state) => ({132 partialize: (state) => ({
127 byThreadKey: state.byThreadKey,133 byThreadKey: state.byThreadKey,
128 branchBaseRefByThreadKey: state.branchBaseRefByThreadKey,134 branchBaseRefByThreadKey: state.branchBaseRefByThreadKey,
135 diffRenderMode: state.diffRenderMode,
129 }),136 }),
130 },137 },
131 ),138 ),

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t