fix: reserve Untitled Project name; rename project will trigger save immidiatly.

This commit is contained in:
Xiaohan-Tian
2026-04-16 20:24:43 -07:00
parent 3010cf4e2d
commit 24ffaa76f6
5 changed files with 79 additions and 11 deletions
+12
View File
@@ -18,6 +18,8 @@ import type { RenderingEvent } from './core/audio-interface/KGOfflineRenderer';
import { KGCore } from './core/KGCore';
import { ConfigManager } from './core/config/ConfigManager';
import { validateFunctionalChordsJSON } from './util/scaleUtil';
import { KGProjectStorage } from './core/io/KGProjectStorage';
import { RESERVED_PROJECT_NAME } from './util/projectNameUtil';
function App() {
// Enable global keyboard handler for copy/paste and undo/redo
@@ -42,6 +44,16 @@ function App() {
hasInitialized.current = true;
const initializeApp = async () => {
// Wipe the reserved "Untitled Project" OPFS folder on every startup so it stays ephemeral
try {
const storage = KGProjectStorage.getInstance();
if (await storage.exists(RESERVED_PROJECT_NAME)) {
await storage.delete(RESERVED_PROJECT_NAME);
}
} catch (error) {
console.warn('Could not clear Untitled Project folder on startup:', error);
}
// Load the current project from KGCore
loadProject(null);