chore: refresh UI after deleting all sorts (#2573)

* chore: disable snapshot for now

* chore: notify the fronted to refresh after deleting all the sorts
This commit is contained in:
Nathan.fooo
2023-05-21 12:08:14 +08:00
committed by GitHub
parent 6c31cf9555
commit eaa1dcdeb9
5 changed files with 36 additions and 25 deletions

View File

@ -51,9 +51,7 @@ impl DatabaseManager2 {
*self.user_database.lock() = Some(InnerUserDatabase::new(
user_id,
db,
RocksDBConfig::default()
.enable_snapshot(true)
.snapshot_per_update(10),
RocksDBConfig::default(),
UserDatabaseCollabBuilderImpl(self.collab_builder.clone()),
));
// do nothing

View File

@ -465,8 +465,9 @@ impl DatabaseViewEditor {
pub async fn v_delete_all_sorts(&self) -> FlowyResult<()> {
let all_sorts = self.v_get_all_sorts().await;
self.delegate.remove_all_sorts(&self.view_id);
self.sort_controller.write().await.delete_all_sorts().await;
self.delegate.remove_all_sorts(&self.view_id);
let mut notification = SortChangesetNotificationPB::new(self.view_id.clone());
notification.delete_sorts = all_sorts.into_iter().map(SortPB::from).collect();
notify_did_update_sort(notification).await;

View File

@ -90,7 +90,7 @@ impl SortController {
let event_type = SortEvent::from_str(predicate).unwrap();
let mut rows = self.delegate.get_rows(&self.view_id).await;
match event_type {
SortEvent::SortDidChanged => {
SortEvent::SortDidChanged | SortEvent::DeleteAllSorts => {
self.sort_rows(&mut rows).await;
let row_orders = rows
.iter()
@ -165,7 +165,7 @@ impl SortController {
pub async fn delete_all_sorts(&mut self) {
self.sorts.clear();
self
.gen_task(SortEvent::SortDidChanged, QualityOfService::Background)
.gen_task(SortEvent::DeleteAllSorts, QualityOfService::Background)
.await;
}
@ -292,6 +292,7 @@ fn cmp_cell(
enum SortEvent {
SortDidChanged,
RowDidChanged(RowId),
DeleteAllSorts,
}
impl ToString for SortEvent {