Request persistent storage when creating a project

This commit is contained in:
Alex Gleason committed 2025-09-24 23:13:29 -05:00
1 parent 980cb60f1b
commit a20bbfdf29
3 files changed
+148 -18

No files matched your search

+17
View File
@@ -1,6 +1,7 @@
import { Buffer } from 'buffer';
import type { Git } from '@/lib/git';
import type { JSRuntimeFS } from '@/lib/JSRuntime';
import { ensurePersistentStorage } from '@/lib/persistentStorage';
// Polyfill Buffer for browser
if (typeof window !== 'undefined') {
@@ -92,6 +93,14 @@ export class ProjectsManager {
},
});
// Automatically request persistent storage after project creation
try {
await ensurePersistentStorage();
} catch (error) {
// Don't fail project creation if persistent storage request fails
console.warn('Failed to request persistent storage after project creation:', error);
}
return project;
}
@@ -119,6 +128,14 @@ export class ProjectsManager {
const stats = await this.fs.stat(projectPath);
const timestamp = stats.mtimeMs ? new Date(stats.mtimeMs) : new Date();
// Automatically request persistent storage after project cloning
try {
await ensurePersistentStorage();
} catch (error) {
// Don't fail project cloning if persistent storage request fails
console.warn('Failed to request persistent storage after project cloning:', error);
}
// Return the full project object with dynamically generated properties
return {
id,