Flush accepted tab moves before replacement restoration
This commit is contained in:
@@ -67,18 +67,14 @@ class TabLocations {
|
||||
entry.key: durableTabRoute(entry.value),
|
||||
},
|
||||
);
|
||||
_writes = _writes.then((_) async {
|
||||
if (_disposed) return;
|
||||
try {
|
||||
final saved = await orderedLocalStorage<bool?>(_storageKey, () async {
|
||||
if (_disposed) return null;
|
||||
return store.save(snapshot);
|
||||
});
|
||||
if (saved != null) persistenceFailed = !saved;
|
||||
} catch (_) {
|
||||
persistenceFailed = true;
|
||||
}
|
||||
});
|
||||
// Queue the accepted snapshot immediately, before a replacement owner's
|
||||
// load can enter the same key's order. Disposal prevents new records, but
|
||||
// must not discard the last valid move already accepted from the user.
|
||||
_writes = orderedLocalStorage(_storageKey, () => store.save(snapshot))
|
||||
.then<void>(
|
||||
(saved) => persistenceFailed = !saved,
|
||||
onError: (Object _, StackTrace _) => persistenceFailed = true,
|
||||
);
|
||||
}
|
||||
|
||||
void dispose() => _disposed = true;
|
||||
|
||||
Reference in New Issue
Block a user