fix: potential async errors (#1772)

This commit is contained in:
Nathan.fooo
2023-01-31 19:30:48 +08:00
committed by GitHub
parent aa15a45097
commit 71022ed934
23 changed files with 206 additions and 223 deletions

View File

@ -48,7 +48,7 @@ flowy-codegen = { path = "../flowy-codegen"}
[features]
default = []
default = ["rev-sqlite"]
sync = []
cloud_sync = ["sync"]
rev-sqlite = ["flowy-sqlite", "flowy-folder/rev-sqlite"]

View File

@ -209,7 +209,7 @@ impl ViewController {
let deleted_view = self
.persistence
.begin_transaction(|transaction| {
let view = transaction.read_view(&view_id)?;
let view = transaction.read_view(view_id)?;
let views = read_belonging_views_on_local(&view.app_id, self.trash_controller.clone(), &transaction)?;
let index = views
@ -223,12 +223,12 @@ impl ViewController {
})
.await?;
send_notification(&view_id, FolderNotification::ViewMoveToTrash)
send_notification(view_id, FolderNotification::ViewMoveToTrash)
.payload(deleted_view)
.send();
let processor = self.get_data_processor_from_view_id(&view_id).await?;
processor.close_view(&view_id).await?;
let processor = self.get_data_processor_from_view_id(view_id).await?;
processor.close_view(view_id).await?;
Ok(())
}

View File

@ -62,7 +62,7 @@ pub(crate) async fn delete_view_handler(
) -> Result<(), FlowyError> {
let params: RepeatedViewIdPB = data.into_inner();
for view_id in &params.items {
let _ = view_controller.move_view_to_trash(&view_id).await;
let _ = view_controller.move_view_to_trash(view_id).await;
}
let trash = view_controller