mirror of
https://github.com/OpenCut-app/OpenCut.git
synced 2026-07-13 21:52:53 +02:00
fix rendering issue from v1 to current
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user