Skip to content

Commit 07fd300

Browse files
Jacksondr5claude
andcommitted
fix(web): the welcome wizard keeps the project selection when you go back a stage
The import step kept its project selection in its own state, so clicking an earlier stage in the wizard's header unmounted it and Continue brought back the default selection. The wizard now owns the selection, like it already does for the chosen computers. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 90c455f commit 07fd300

2 files changed

Lines changed: 26 additions & 4 deletions

File tree

‎apps/web/src/components/onboarding/WelcomeWizard.import.browser.test.tsx‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,22 @@ function setup() {
258258
return now;
259259
}
260260

261+
it("keeps the project selection after going back a stage", async () => {
262+
using _now = setup();
263+
await using _screen = await mountImport();
264+
await click("Select none");
265+
expect(pageText()).toContain("0 of 2 selected");
266+
267+
const agentsStage = document.querySelector<HTMLButtonElement>(
268+
'button[aria-label="Agents, step 2"]',
269+
);
270+
expect(agentsStage?.disabled).toBe(false);
271+
await act(async () => agentsStage?.click());
272+
await click("Continue");
273+
expect(pageText()).toContain("Import your projects");
274+
expect(pageText()).toContain("0 of 2 selected");
275+
});
276+
261277
it("rechecks after project creation and can retry its history without recreating the project", async () => {
262278
using _now = setup();
263279
const creation = deferred<void>();

‎apps/web/src/components/onboarding/WelcomeWizard.tsx‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ export function WelcomeWizard({
124124
const [setupIds, setSetupIds] = useState<readonly EnvironmentId[]>(
125125
resumeEnvironmentId ? [resumeEnvironmentId] : [],
126126
);
127+
const [importSelection, setImportSelection] = useState<ReadonlySet<string> | null>(null);
127128
const [isImporting, setIsImporting] = useState(false);
128129
const finishingPromiseRef = useRef<Promise<boolean> | null>(null);
129130
const completionErrorToastIdRef = useRef<ReturnType<typeof toastManager.add> | null>(null);
@@ -278,6 +279,8 @@ export function WelcomeWizard({
278279
) : (
279280
<ImportStep
280281
scans={scans}
282+
selectedPaths={importSelection}
283+
onSelectedPathsChange={setImportSelection}
281284
isImporting={isImporting}
282285
setIsImporting={setIsImporting}
283286
onDone={finish}
@@ -1172,11 +1175,15 @@ const IMPORT_PERMISSION_MESSAGE = "This connection cannot import projects or thr
11721175

11731176
function ImportStep({
11741177
scans,
1178+
selectedPaths,
1179+
onSelectedPathsChange,
11751180
isImporting,
11761181
setIsImporting,
11771182
onDone,
11781183
}: {
11791184
readonly scans: ReturnType<typeof useProjectScans>;
1185+
readonly selectedPaths: ReadonlySet<string> | null;
1186+
readonly onSelectedPathsChange: (next: ReadonlySet<string>) => void;
11801187
readonly isImporting: boolean;
11811188
readonly setIsImporting: (value: boolean) => void;
11821189
readonly onDone: (
@@ -1190,7 +1197,6 @@ function ImportStep({
11901197
const createProject = useAtomCommand(projectEnvironment.create, { reportFailure: false });
11911198
const importThreads = useAtomCommand(agentSessionImport, { reportFailure: false });
11921199
const projects = useProjects();
1193-
const [selectedPaths, setSelectedPaths] = useState<ReadonlySet<string> | null>(null);
11941200
const importWarningRef = useRef("");
11951201
const importedThreadCountRef = useRef(0);
11961202
const [landingProject, setLandingProject] = useState<ScopedProjectRef | null>(null);
@@ -1432,15 +1438,15 @@ function ImportStep({
14321438
variant="ghost"
14331439
size="xs"
14341440
disabled={isImporting || selected.length === candidates.length}
1435-
onClick={() => setSelectedPaths(new Set(candidates.map((item) => item.key)))}
1441+
onClick={() => onSelectedPathsChange(new Set(candidates.map((item) => item.key)))}
14361442
>
14371443
Select all
14381444
</Button>
14391445
<Button
14401446
variant="ghost"
14411447
size="xs"
14421448
disabled={isImporting || selected.length === 0}
1443-
onClick={() => setSelectedPaths(new Set())}
1449+
onClick={() => onSelectedPathsChange(new Set())}
14441450
>
14451451
Select none
14461452
</Button>
@@ -1493,7 +1499,7 @@ function ImportStep({
14931499
<ImportCandidateList
14941500
candidates={scanCandidates}
14951501
selectedKeys={selectedKeys}
1496-
onSelectionChange={setSelectedPaths}
1502+
onSelectionChange={onSelectedPathsChange}
14971503
/>
14981504
</fieldset>
14991505
);

0 commit comments

Comments
 (0)