[flutter]: fix ui update

This commit is contained in:
appflowy 2021-10-17 23:08:39 +08:00
parent d1b7fd29a6
commit 315c8b107a
2 changed files with 6 additions and 9 deletions

View File

@ -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));
}
}
}

View File

@ -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>(())