fix: group by field (#1374)

This commit is contained in:
Nathan.fooo 2022-10-26 21:46:47 +08:00 committed by GitHub
parent c7c9048fe3
commit c8044a92d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 22 deletions

View File

@ -465,19 +465,6 @@ pub struct FieldChangesetParams {
pub type_option_data: Option<Vec<u8>>,
}
impl FieldChangesetParams {
pub fn has_changes(&self) -> bool {
self.name.is_some()
|| self.desc.is_some()
|| self.field_type.is_some()
|| self.frozen.is_some()
|| self.type_option_data.is_some()
|| self.frozen.is_some()
|| self.visibility.is_some()
|| self.width.is_some()
}
}
/// Certain field types have user-defined options such as color, date format, number format,
/// or a list of values for a multi-select list. These options are defined within a specialization
/// of the FieldTypeOption class.

View File

@ -109,10 +109,6 @@ impl GridRevisionEditor {
field_id: &str,
type_option_data: Vec<u8>,
) -> FlowyResult<()> {
if type_option_data.is_empty() {
return Ok(());
}
let result = self.get_field_rev(field_id).await;
if result.is_none() {
tracing::warn!("Can't find the field with id: {}", field_id);
@ -307,10 +303,6 @@ impl GridRevisionEditor {
#[tracing::instrument(level = "debug", skip_all, err)]
async fn update_field_rev(&self, params: FieldChangesetParams, field_type: FieldType) -> FlowyResult<()> {
let mut is_type_option_changed = false;
if !params.has_changes() {
return Ok(());
}
let _ = self
.modify(|grid| {
let changeset = grid.modify_field(&params.field_id, |field| {
@ -334,11 +326,11 @@ impl GridRevisionEditor {
}
if let Some(type_option_data) = params.type_option_data {
let deserializer = TypeOptionJsonDeserializer(field_type);
is_type_option_changed = true;
match deserializer.deserialize(type_option_data) {
Ok(json_str) => {
let field_type = field.ty;
field.insert_type_option_str(&field_type, json_str);
is_type_option_changed = true;
}
Err(err) => {
tracing::error!("Deserialize data to type option json failed: {}", err);