mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-09-11 19:17:43 +03: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();
|
||||
af_spawn(async move {
|
||||
while let Ok(row_change) = row_change.recv().await {
|
||||
if weak_database.upgrade().is_none() {
|
||||
break;
|
||||
}
|
||||
|
||||
if let Some(database) = weak_database.upgrade() {
|
||||
trace!(
|
||||
"[Database Observe]: {} row change:{:?}",
|
||||
database_id,
|
||||
@ -61,14 +58,19 @@ pub(crate) async fn observe_rows_change(
|
||||
} => {
|
||||
let cell_id = format!("{}:{}", row_id, field_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.
|
||||
// notify_row(¬ification_sender, &database_id, field_id, &row_id);
|
||||
|
||||
let views = database.lock().get_all_database_views_meta();
|
||||
for view in views {
|
||||
notify_row(¬ification_sender, &view.id, &field_id, &row_id);
|
||||
}
|
||||
},
|
||||
_ => {
|
||||
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)]
|
||||
fn notify_row(
|
||||
notification_sender: &Arc<DebounceNotificationSender>,
|
||||
_database_id: &str,
|
||||
field_id: String,
|
||||
view_id: &str,
|
||||
field_id: &str,
|
||||
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 subject = NotificationBuilder::new(
|
||||
row_id,
|
||||
view_id,
|
||||
DatabaseNotification::DidUpdateRow,
|
||||
DATABASE_OBSERVABLE_SOURCE,
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user