fix: auto-open configured web project
This commit is contained in:
parent
0f5a606923
commit
33560c9b09
1 changed files with 11 additions and 1 deletions
|
|
@ -338,7 +338,9 @@ export function ProjectsPanel({
|
|||
|
||||
setDevRoot(prefs.devRoot);
|
||||
const discovered = await loadProjects(prefs.devRoot);
|
||||
if (!cancelled) setProjects(discovered);
|
||||
if (!cancelled) {
|
||||
setProjects(discovered);
|
||||
}
|
||||
} catch (err) {
|
||||
if (!cancelled) {
|
||||
setError(err instanceof Error ? err.message : "Unknown error");
|
||||
|
|
@ -1148,6 +1150,14 @@ export function ProjectSelectionGate() {
|
|||
};
|
||||
}, [loadProjects]);
|
||||
|
||||
useEffect(() => {
|
||||
if (loading || projects.length !== 1) return;
|
||||
const [onlyProject] = projects;
|
||||
if (onlyProject?.path === devRoot) {
|
||||
manager.switchProject(onlyProject.path);
|
||||
}
|
||||
}, [devRoot, loading, manager, projects]);
|
||||
|
||||
const handleDevRootSaved = useCallback(async (newRoot: string) => {
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue