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,30 +44,32 @@ 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!(
|
||||||
}
|
"[Database Observe]: {} row change:{:?}",
|
||||||
|
database_id,
|
||||||
|
row_change
|
||||||
|
);
|
||||||
|
match row_change {
|
||||||
|
RowChange::DidUpdateCell {
|
||||||
|
field_id,
|
||||||
|
row_id,
|
||||||
|
value: _,
|
||||||
|
} => {
|
||||||
|
let cell_id = format!("{}:{}", row_id, field_id);
|
||||||
|
notify_cell(¬ification_sender, &cell_id);
|
||||||
|
|
||||||
trace!(
|
let views = database.lock().get_all_database_views_meta();
|
||||||
"[Database Observe]: {} row change:{:?}",
|
for view in views {
|
||||||
database_id,
|
notify_row(¬ification_sender, &view.id, &field_id, &row_id);
|
||||||
row_change
|
}
|
||||||
);
|
},
|
||||||
match row_change {
|
_ => {
|
||||||
RowChange::DidUpdateCell {
|
warn!("unhandled row change: {:?}", row_change);
|
||||||
field_id,
|
},
|
||||||
row_id,
|
}
|
||||||
value: _,
|
} else {
|
||||||
} => {
|
break;
|
||||||
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);
|
|
||||||
},
|
|
||||||
_ => {
|
|
||||||
warn!("unhandled row change: {:?}", row_change);
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -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