Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

fix: send database notification on create row (#2926)

Mohammad Zolfagharid4a23657d739
diff --git a/frontend/rust-lib/flowy-database2/src/services/database_view/view_editor.rs b/frontend/rust-lib/flowy-database2/src/services/database_view/view_editor.rs
index e5a63d340a..1be0edfa3d 100644
--- a/frontend/rust-lib/flowy-database2/src/services/database_view/view_editor.rs
+++ b/frontend/rust-lib/flowy-database2/src/services/database_view/view_editor.rs
@@ -216,14 +216,12 @@ impl DatabaseViewEditor {
group_id: &Option<String>,
index: usize,
) {
+ let changes: RowsChangePB;
// Send the group notification if the current view has groups
match group_id.as_ref() {
None => {
let row = InsertedRowPB::new(RowMetaPB::from(&row_detail.meta)).with_index(index as i32);
- let changes = RowsChangePB::from_insert(self.view_id.clone(), row);
- send_notification(&self.view_id, DatabaseNotification::DidUpdateViewRows)
- .payload(changes)
- .send();
+ changes = RowsChangePB::from_insert(self.view_id.clone(), row);
},
Some(group_id) => {
self
@@ -238,10 +236,16 @@ impl DatabaseViewEditor {
index: Some(index as i32),
is_new: true,
};
- let changeset = GroupRowsNotificationPB::insert(group_id.clone(), vec![inserted_row]);
+ let changeset =
+ GroupRowsNotificationPB::insert(group_id.clone(), vec![inserted_row.clone()]);
notify_did_update_group_rows(changeset).await;
+ changes = RowsChangePB::from_insert(self.view_id.clone(), inserted_row);
},
}
+
+ send_notification(&self.view_id, DatabaseNotification::DidUpdateViewRows)
+ .payload(changes)
+ .send();
}
#[tracing::instrument(level = "trace", skip_all)]