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:
@@ -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'));
|
||||
}
|
||||
}, []);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user