Handle resuming migration with app opened in multiple tabs

- Secure context:
  - Yes: allow only one tab to resume the migration
  - No: disable resume functionality
- Sync progress between tabs
This commit is contained in:
schroda
2026-06-06 17:45:43 +02:00
parent 4ec3c62ae5
commit fb439d058e
7 changed files with 111 additions and 30 deletions

View File

@@ -212,7 +212,14 @@ const ReactRouterSetter = () => {
const ResumeMigration = () => {
useEffect(() => {
if (!MigrationManager.isActive()) {
MigrationManager.resume().catch(defaultPromiseErrorHandler('ResumeMigration'));
navigator.locks
.request('migration-executor', async () => {
const resumed = await MigrationManager.resume();
if (resumed) {
await MigrationManager.awaitCompletion();
}
})
.catch(defaultPromiseErrorHandler('ResumeMigration'));
}
}, []);