Skip to content

Commit 9c04cb5

Browse files
committed
fix(review): import shared type and apply setup choice to active diff
Import DefaultDiffType from @plannotator/shared/config instead of duplicating the type locally. Pass the selected diff type back through onComplete so the current review switches immediately when the user picks a different default. For provenance purposes, this commit was AI assisted.
1 parent 55ad8ec commit 9c04cb5

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

packages/review-editor/App.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1928,7 +1928,10 @@ const ReviewApp: React.FC = () => {
19281928
{/* Diff type setup dialog — first-run only */}
19291929
{showDiffTypeSetup && (
19301930
<DiffTypeSetupDialog
1931-
onComplete={() => setShowDiffTypeSetup(false)}
1931+
onComplete={(selected) => {
1932+
setShowDiffTypeSetup(false);
1933+
if (selected !== diffType) handleDiffSwitch(selected);
1934+
}}
19321935
/>
19331936
)}
19341937

packages/ui/components/DiffTypeSetupDialog.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import React, { useState } from 'react';
22
import { createPortal } from 'react-dom';
3+
import type { DefaultDiffType } from '@plannotator/shared/config';
34
import { markDiffTypeSetupDone } from '../utils/diffTypeSetup';
45
import { configStore } from '../config';
56

6-
type DefaultDiffType = 'uncommitted' | 'unstaged' | 'staged';
7-
87
const OPTIONS: { value: DefaultDiffType; label: string; description: string }[] = [
98
{
109
value: 'unstaged',
@@ -24,20 +23,20 @@ const OPTIONS: { value: DefaultDiffType; label: string; description: string }[]
2423
];
2524

2625
interface DiffTypeSetupDialogProps {
27-
onComplete: () => void;
26+
onComplete: (selected: DefaultDiffType) => void;
2827
}
2928

3029
export const DiffTypeSetupDialog: React.FC<DiffTypeSetupDialogProps> = ({
3130
onComplete,
3231
}) => {
3332
const [selected, setSelected] = useState<DefaultDiffType>(
34-
() => configStore.get('defaultDiffType') as DefaultDiffType
33+
() => configStore.get('defaultDiffType')
3534
);
3635

3736
const handleDone = () => {
3837
configStore.set('defaultDiffType', selected);
3938
markDiffTypeSetupDone();
40-
onComplete();
39+
onComplete(selected);
4140
};
4241

4342
return createPortal(

0 commit comments

Comments
 (0)