mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: fix test
This commit is contained in:
parent
cadb177acd
commit
401ce7dfea
@ -44,10 +44,7 @@ pub(crate) async fn observe_rows_change(
|
|||||||
let mut row_change = database.lock().subscribe_row_change();
|
let mut row_change = database.lock().subscribe_row_change();
|
||||||
af_spawn(async move {
|
af_spawn(async move {
|
||||||
while let Ok(row_change) = row_change.recv().await {
|
while let Ok(row_change) = row_change.recv().await {
|
||||||
if weak_database.upgrade().is_none() {
|
if let Some(database) = weak_database.upgrade() {
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
trace!(
|
trace!(
|
||||||
"[Database Observe]: {} row change:{:?}",
|
"[Database Observe]: {} row change:{:?}",
|
||||||
database_id,
|
database_id,
|
||||||
@ -61,14 +58,19 @@ pub(crate) async fn observe_rows_change(
|
|||||||
} => {
|
} => {
|
||||||
let cell_id = format!("{}:{}", row_id, field_id);
|
let cell_id = format!("{}:{}", row_id, field_id);
|
||||||
notify_cell(¬ification_sender, &cell_id);
|
notify_cell(¬ification_sender, &cell_id);
|
||||||
// In the old logic, it will notify the row when the cell is updated. But in the new logic,
|
|
||||||
// it will notify the cell only. Enable the following code if needed.
|
let views = database.lock().get_all_database_views_meta();
|
||||||
// notify_row(¬ification_sender, &database_id, field_id, &row_id);
|
for view in views {
|
||||||
|
notify_row(¬ification_sender, &view.id, &field_id, &row_id);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
_ => {
|
_ => {
|
||||||
warn!("unhandled row change: {:?}", row_change);
|
warn!("unhandled row change: {:?}", row_change);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -168,14 +170,14 @@ pub(crate) async fn observe_block_event(database_id: &str, database: &Arc<MutexD
|
|||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
fn notify_row(
|
fn notify_row(
|
||||||
notification_sender: &Arc<DebounceNotificationSender>,
|
notification_sender: &Arc<DebounceNotificationSender>,
|
||||||
_database_id: &str,
|
view_id: &str,
|
||||||
field_id: String,
|
field_id: &str,
|
||||||
row_id: &RowId,
|
row_id: &RowId,
|
||||||
) {
|
) {
|
||||||
let update_row = UpdatedRow::new(row_id).with_field_ids(vec![field_id]);
|
let update_row = UpdatedRow::new(row_id).with_field_ids(vec![field_id.to_string()]);
|
||||||
let update_changeset = RowsChangePB::from_update(update_row.into());
|
let update_changeset = RowsChangePB::from_update(update_row.into());
|
||||||
let subject = NotificationBuilder::new(
|
let subject = NotificationBuilder::new(
|
||||||
row_id,
|
view_id,
|
||||||
DatabaseNotification::DidUpdateRow,
|
DatabaseNotification::DidUpdateRow,
|
||||||
DATABASE_OBSERVABLE_SOURCE,
|
DATABASE_OBSERVABLE_SOURCE,
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user