mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-01 20:23:36 +00:00
fix: automatically remove projects with non-existent paths
When a project fails to initialize because the directory no longer exists (e.g., test artifacts, deleted folders), automatically remove it from the project list instead of showing the error repeatedly on every reload. This prevents users from being stuck with broken project references in their settings after testing or when project directories are moved/deleted. The user is notified with a toast message explaining the removal. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -124,6 +124,19 @@ export function DashboardView() {
|
||||
const initResult = await initializeProject(path);
|
||||
|
||||
if (!initResult.success) {
|
||||
// If the project directory doesn't exist, automatically remove it from the project list
|
||||
if (initResult.error?.includes('does not exist')) {
|
||||
const projectToRemove = projects.find((p) => p.path === path);
|
||||
if (projectToRemove) {
|
||||
logger.warn(`[Dashboard] Removing project with non-existent path: ${path}`);
|
||||
moveProjectToTrash(projectToRemove.id);
|
||||
toast.error('Project directory not found', {
|
||||
description: `Removed ${name} from your projects list since the directory no longer exists.`,
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
toast.error('Failed to initialize project', {
|
||||
description: initResult.error || 'Unknown error occurred',
|
||||
});
|
||||
@@ -151,7 +164,15 @@ export function DashboardView() {
|
||||
setIsOpening(false);
|
||||
}
|
||||
},
|
||||
[trashedProjects, currentProject, globalTheme, upsertAndSetCurrentProject, navigate]
|
||||
[
|
||||
projects,
|
||||
trashedProjects,
|
||||
currentProject,
|
||||
globalTheme,
|
||||
upsertAndSetCurrentProject,
|
||||
navigate,
|
||||
moveProjectToTrash,
|
||||
]
|
||||
);
|
||||
|
||||
const handleOpenProject = useCallback(async () => {
|
||||
|
||||
Reference in New Issue
Block a user