summaryrefslogtreecommitdiff
path: root/apps/web/src/services/storage/migrations/runner.ts
diff options
context:
space:
mode:
authorMaze Winther <mazewinther@gmail.com>2026-02-05 14:44:31 +0100
committerMaze Winther <mazewinther@gmail.com>2026-02-05 14:44:31 +0100
commit464a6e83b96a400614bea9973aeb0278d03daa0b (patch)
tree9eaf84183913f8059f1a7d9ca589565b9e4d01be /apps/web/src/services/storage/migrations/runner.ts
parentd0b4b1a5fc439d68371d8cfa677348250afec88b (diff)
downloadopencut-464a6e83b96a400614bea9973aeb0278d03daa0b.tar.gz
fix rendering issue from v1 to current
Diffstat (limited to 'apps/web/src/services/storage/migrations/runner.ts')
-rw-r--r--apps/web/src/services/storage/migrations/runner.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/apps/web/src/services/storage/migrations/runner.ts b/apps/web/src/services/storage/migrations/runner.ts
index bd34c661..b261252b 100644
--- a/apps/web/src/services/storage/migrations/runner.ts
+++ b/apps/web/src/services/storage/migrations/runner.ts
@@ -19,6 +19,8 @@ export interface MigrationProgress {
let hasCleanedUpMetaDb = false;
+const MIN_MIGRATION_DISPLAY_MS = 1000;
+
export async function runStorageMigrations({
migrations,
onProgress,
@@ -45,6 +47,7 @@ export async function runStorageMigrations({
const orderedMigrations = [...migrations].sort((a, b) => a.from - b.from);
let migratedCount = 0;
+ let migrationStartTime: number | null = null;
for (const project of projects) {
if (typeof project !== "object" || project === null) {
@@ -59,6 +62,11 @@ export async function runStorageMigrations({
continue;
}
+ // Track when we first showed the migration dialog
+ if (migrationStartTime === null) {
+ migrationStartTime = Date.now();
+ }
+
const projectName = getProjectName({ project: projectRecord });
onProgress?.({
isMigrating: true,
@@ -90,6 +98,16 @@ export async function runStorageMigrations({
}
}
+ // Ensure dialog is visible for minimum time so users can see it
+ if (migrationStartTime !== null) {
+ const elapsed = Date.now() - migrationStartTime;
+ if (elapsed < MIN_MIGRATION_DISPLAY_MS) {
+ await new Promise((resolve) =>
+ setTimeout(resolve, MIN_MIGRATION_DISPLAY_MS - elapsed),
+ );
+ }
+ }
+
onProgress?.({
isMigrating: false,
fromVersion: null,