fix rendering issue from v1 to current

This commit is contained in:
Maze Winther
2026-02-05 14:44:31 +01:00
parent d0b4b1a5fc
commit 464a6e83b9
5 changed files with 62 additions and 42 deletions
@@ -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,