From 4681e2d87c38bbe63a8ccdb98e80f67ad54867c1 Mon Sep 17 00:00:00 2001 From: Thiago Carvalho <32248947+thiagocarvalhodev@users.noreply.github.com> Date: Mon, 18 Nov 2024 09:26:29 -0300 Subject: [PATCH] fix(attach drives) --- lib/blocs/drive_detail/drive_detail_cubit.dart | 13 +++++++++++-- lib/pages/drive_detail/drive_detail_page.dart | 3 ++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/blocs/drive_detail/drive_detail_cubit.dart b/lib/blocs/drive_detail/drive_detail_cubit.dart index 46b7948e0..eeea5c7c0 100644 --- a/lib/blocs/drive_detail/drive_detail_cubit.dart +++ b/lib/blocs/drive_detail/drive_detail_cubit.dart @@ -138,12 +138,21 @@ class DriveDetailCubit extends Cubit { _folderSubscription = Rx.combineLatest3( _driveRepository.watchDrive(driveId: driveId), - _driveDao.watchFolderContents( + _driveDao + .watchFolderContents( driveId, orderBy: contentOrderBy, orderingMode: contentOrderingMode, folderId: folderId, - ), + ) + .handleError((error, stack) { + logger.e('Error watching folder contents', error, stack); + if (error is DriveNotFoundException) { + emit(DriveDetailLoadNotFound()); + } + + return null; + }), _profileCubit.stream.startWith(ProfileCheckingAvailability()), (drive, folderContents, _) async { if (isClosed) { diff --git a/lib/pages/drive_detail/drive_detail_page.dart b/lib/pages/drive_detail/drive_detail_page.dart index fdb05db35..6a67e56d7 100644 --- a/lib/pages/drive_detail/drive_detail_page.dart +++ b/lib/pages/drive_detail/drive_detail_page.dart @@ -132,7 +132,8 @@ class _DriveDetailPageState extends State { child: BlocListener( listener: (context, state) { if (state is DrivesLoadSuccess) { - if (state.userDrives.isNotEmpty) { + if (state.userDrives.isNotEmpty || + state.sharedDrives.isNotEmpty) { final driveDetailState = context.read().state; if (driveDetailState is DriveDetailLoadSuccess &&