mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
Merge pull request #1176 from AppFlowy-IO/fix/update_group_if_field_changed
fix: update the group when the corresponding field changed
This commit is contained in:
commit
f66b3a447c
@ -201,6 +201,10 @@ impl GridViewRevisionEditor {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) async fn group_id(&self) -> String {
|
||||
self.group_controller.read().await.field_id().to_owned()
|
||||
}
|
||||
|
||||
pub(crate) async fn get_setting(&self) -> GridSettingPB {
|
||||
let field_revs = self.field_delegate.get_field_revs().await;
|
||||
let grid_setting = make_grid_setting(&*self.pad.read().await, &field_revs);
|
||||
|
@ -178,12 +178,16 @@ impl GridViewManager {
|
||||
#[tracing::instrument(level = "trace", skip(self), err)]
|
||||
pub(crate) async fn did_update_field(&self, field_id: &str, is_type_option_changed: bool) -> FlowyResult<()> {
|
||||
let view_editor = self.get_default_view_editor().await?;
|
||||
// Only the field_id of the updated field is equal to the field_id of the group.
|
||||
// Update the group
|
||||
if view_editor.group_id().await != field_id {
|
||||
return Ok(());
|
||||
}
|
||||
if is_type_option_changed {
|
||||
let _ = view_editor.group_by_field(field_id).await?;
|
||||
} else {
|
||||
let _ = view_editor.did_update_field(field_id).await?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user