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
1010 | { kind: "unstaged" }
1111 | { kind: "turn"; turnId: TurnId; filePath: string | null; revealRequestId: number };
1212
13+export type DiffRenderMode = "stacked" | "split";
14+
1315 const DEFAULT_SELECTION: DiffPanelSelection = { kind: "branch", baseRef: null };
1416 const DEFAULT_WORKING_TREE_SELECTION: DiffPanelSelection = { kind: "unstaged" };
1517
1618 interface DiffPanelStoreState {
1719 byThreadKey: Record<string, DiffPanelSelection>;
1820 branchBaseRefByThreadKey: Record<string, string | null>;
21+ diffRenderMode: DiffRenderMode;
22+ setDiffRenderMode: (mode: DiffRenderMode) => void;
1923 selectGitScope: (ref: ScopedThreadRef, scope: "branch" | "unstaged") => void;
2024 selectBranchBaseRef: (ref: ScopedThreadRef, baseRef: string | null) => void;
2125 selectTurn: (ref: ScopedThreadRef, turnId: TurnId, filePath?: string) => void;
@@ -33,6 +37,8 @@ export const useDiffPanelStore = create<DiffPanelStoreState>()( · 11 unmodified lines
3337 (set) => ({
3438 byThreadKey: {},
3539 branchBaseRefByThreadKey: {},
40+ diffRenderMode: "stacked",
41+ setDiffRenderMode: (diffRenderMode) => set({ diffRenderMode }),
3642 selectGitScope: (ref, scope) =>
3743 set((state) => {
3844 const threadKey = scopedThreadKey(ref);
@@ -126,6 +132,7 @@ export const useDiffPanelStore = create<DiffPanelStoreState>()( · 87 unmodified lines
126132 partialize: (state) => ({
127133 byThreadKey: state.byThreadKey,
128134 branchBaseRefByThreadKey: state.branchBaseRefByThreadKey,
135+ diffRenderMode: state.diffRenderMode,
129136 }),
130137 },
131138 ),

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