diff --git a/lib/blocs/drive_detail/drive_detail_cubit.dart b/lib/blocs/drive_detail/drive_detail_cubit.dart index 7000807446..02b1e443f3 100644 --- a/lib/blocs/drive_detail/drive_detail_cubit.dart +++ b/lib/blocs/drive_detail/drive_detail_cubit.dart @@ -149,12 +149,6 @@ class DriveDetailCubit extends Cubit { return; } - if (driveId != _driveId) { - await _folderSubscription?.cancel(); - _folderSubscription = null; - return; - } - await _syncCubit.waitCurrentSync(); if (drive == null) { @@ -294,6 +288,8 @@ class DriveDetailCubit extends Cubit { logger.e('An error occured mouting the drive explorer', e); }); + + await _folderSubscription?.asFuture(); } List parseEntitiesToDatatableItem({ diff --git a/lib/blocs/fs_entry_info/fs_entry_info_cubit.dart b/lib/blocs/fs_entry_info/fs_entry_info_cubit.dart index aeed22a476..8488e7f85e 100644 --- a/lib/blocs/fs_entry_info/fs_entry_info_cubit.dart +++ b/lib/blocs/fs_entry_info/fs_entry_info_cubit.dart @@ -39,6 +39,10 @@ class FsEntryInfoCubit extends Cubit { .asStream() .listen( (f) async { + if (isClosed) { + return; + } + final metadataTxId = await _driveDao .latestFolderRevisionByFolderId( driveId: driveId, folderId: selectedItem.id) @@ -132,6 +136,10 @@ class FsEntryInfoCubit extends Cubit { .watchSingle() .listen( (d) async { + if (isClosed) { + return; + } + final rootFolderRevision = await _driveDao .latestFolderRevisionByFolderId( folderId: d.rootFolderId,