Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

[flutter]: fix ui update

appflowy315c8b107a28
diff --git a/app_flowy/lib/workspace/infrastructure/repos/helper.dart b/app_flowy/lib/workspace/infrastructure/repos/helper.dart
index 66cda7166e..a3c3014a4e 100644
--- a/app_flowy/lib/workspace/infrastructure/repos/helper.dart
+++ b/app_flowy/lib/workspace/infrastructure/repos/helper.dart
@@ -1,4 +1,5 @@
import 'dart:typed_data';
+import 'package:flowy_log/flowy_log.dart';
import 'package:flowy_sdk/protobuf/flowy-dart-notify/protobuf.dart';
import 'package:flowy_sdk/protobuf/flowy-user/protobuf.dart';
import 'package:flowy_sdk/protobuf/flowy-workspace/errors.pb.dart';
@@ -49,15 +50,13 @@ class NotificationParser<T, E> {
return;
}
- if (subject.hasPayload()) {
- final bytes = Uint8List.fromList(subject.payload);
- callback(ty, left(bytes));
- } else if (subject.hasError()) {
+ if (subject.hasError()) {
final bytes = Uint8List.fromList(subject.error);
final error = errorParser(bytes);
callback(ty, right(error));
} else {
- // do nothing
+ final bytes = Uint8List.fromList(subject.payload);
+ callback(ty, left(bytes));
}
}
}
diff --git a/rust-lib/flowy-workspace/src/services/trash_can.rs b/rust-lib/flowy-workspace/src/services/trash_can.rs
index d6dedd67d4..4dd07f17c0 100644
--- a/rust-lib/flowy-workspace/src/services/trash_can.rs
+++ b/rust-lib/flowy-workspace/src/services/trash_can.rs
@@ -56,9 +56,8 @@ impl TrashCan {
let _ = thread::scope(|_s| {
let conn = self.database.db_connection()?;
let _ = conn.immediate_transaction::<_, WorkspaceError, _>(|| {
- let repeated_trash = TrashTableSql::read_all(&conn)?;
let _ = TrashTableSql::delete_trash(trash_id, &*conn)?;
- notify_trash_num_changed(repeated_trash);
+ notify_trash_num_changed(TrashTableSql::read_all(&conn)?);
Ok(())
})?;
Ok::<(), WorkspaceError>(())
@@ -128,8 +127,7 @@ impl TrashCan {
let _ = TrashTableSql::create_trash(t.clone().into(), &*conn)?;
}
self.create_trash_on_server(trash);
- let repeated_trash = TrashTableSql::read_all(&conn)?;
- notify_trash_num_changed(repeated_trash);
+ notify_trash_num_changed(TrashTableSql::read_all(&conn)?);
Ok(())
})?;
Ok::<(), WorkspaceError>(())