make storage versioning per-project + few other refactors

This commit is contained in:
Maze Winther
2026-02-05 12:53:56 +01:00
parent 490fc170c0
commit 2257ca2e6f
17 changed files with 301 additions and 540 deletions
+3 -32
View File
@@ -21,7 +21,7 @@ import { buildDefaultScene, getProjectDurationFromScenes } from "@/lib/scenes";
import { buildScene } from "@/services/renderer/scene-builder";
import { CanvasRenderer } from "@/services/renderer/canvas-renderer";
import {
CURRENT_STORAGE_VERSION,
CURRENT_PROJECT_VERSION,
migrations,
runStorageMigrations,
} from "@/services/storage/migrations";
@@ -58,31 +58,7 @@ export class ProjectManager {
}
this.storageMigrationPromise = (async () => {
let hasShownState = false;
await runStorageMigrations({
migrations,
callbacks: {
onMigrationStart: ({ fromVersion, toVersion }) => {
hasShownState = true;
this.setMigrationState({
isMigrating: true,
fromVersion,
toVersion,
projectName: null,
});
},
},
});
if (hasShownState) {
this.setMigrationState({
isMigrating: false,
fromVersion: null,
toVersion: null,
projectName: null,
});
}
await runStorageMigrations({ migrations });
})();
await this.storageMigrationPromise;
@@ -109,7 +85,7 @@ export class ProjectManager {
color: DEFAULT_COLOR,
},
},
version: CURRENT_STORAGE_VERSION,
version: CURRENT_PROJECT_VERSION,
};
this.active = newProject;
@@ -572,11 +548,6 @@ export class ProjectManager {
return this.migrationState;
}
private setMigrationState(state: Partial<MigrationState>): void {
this.migrationState = { ...this.migrationState, ...state };
this.notify();
}
setActiveProject({ project }: { project: TProject }): void {
this.active = project;
this.notify();