Skip to content

Commit fc141d5

Browse files
RedstoneKopfclaude
andcommitted
fix(web): reopening the import dialog rescans cached results
The scan query stays fresh for 30 seconds, so reopening the dialog right after an import showed the previous list. Refresh settled scans once on open; scans still in flight are left alone so a first open does not scan twice. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 358367b commit fc141d5

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎apps/web/src/components/settings/ImportProjectsDialog.tsx‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { EnvironmentId } from "@t3tools/contracts";
2-
import { useState } from "react";
2+
import { useEffect, useState } from "react";
33

44
import { useProjectScans } from "../../onboarding/useProjectScans";
55
import { ProjectImportStep } from "../onboarding/ProjectImportStep";
@@ -17,6 +17,13 @@ export function ImportProjectsDialog({
1717
// Freeze the targets so a reconnect elsewhere does not rescan mid-selection.
1818
const [scanIds] = useState(environmentIds);
1919
const scans = useProjectScans(scanIds);
20+
const [initialScans] = useState(scans);
21+
// oxlint-disable-next-line t3code/no-unreasoned-state-sync -- a cached scan can be up to 30s old on reopen, so rescan once to pick up new conversations; scans already in flight are left alone
22+
useEffect(() => {
23+
for (const scan of initialScans) {
24+
if (scan.data !== null && !scan.isPending) scan.refresh();
25+
}
26+
}, [initialScans]);
2027
const [isImporting, setIsImporting] = useState(false);
2128
const isLoadingProjects =
2229
scans.every((scan) => scan.data === null) && scans.some((scan) => scan.isPending);

0 commit comments

Comments
 (0)