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: empty url group bug (#1755)

Mohammad Zolfaghari59cb4a890a45
diff --git a/frontend/rust-lib/flowy-database/src/services/cell/cell_operation.rs b/frontend/rust-lib/flowy-database/src/services/cell/cell_operation.rs
index 156022153b..fb90f8f32f 100644
--- a/frontend/rust-lib/flowy-database/src/services/cell/cell_operation.rs
+++ b/frontend/rust-lib/flowy-database/src/services/cell/cell_operation.rs
@@ -2,6 +2,7 @@ use crate::entities::FieldType;
use crate::services::cell::{AtomicCellDataCache, CellProtobufBlob, TypeCellData};
use crate::services::field::*;
+use crate::services::group::make_no_status_group;
use flowy_error::{ErrorCode, FlowyError, FlowyResult};
use grid_model::{CellRevision, FieldRevision};
@@ -223,6 +224,16 @@ pub fn insert_number_cell(num: i64, field_rev: &FieldRevision) -> CellRevision {
}
pub fn insert_url_cell(url: String, field_rev: &FieldRevision) -> CellRevision {
+ // checking if url is equal to group id of no status group because everywhere
+ // except group of rows with empty url the group id is equal to the url
+ // so then on the case that url is equal to empty url group id we should change
+ // the url to empty string
+ let _no_status_group_id = make_no_status_group(field_rev).id;
+ let url = match url {
+ a if a == _no_status_group_id => "".to_owned(),
+ _ => url,
+ };
+
let data = apply_cell_data_changeset(url, None, field_rev, None).unwrap();
CellRevision::new(data)
}
diff --git a/frontend/rust-lib/flowy-database/src/services/group/controller_impls/url_controller.rs b/frontend/rust-lib/flowy-database/src/services/group/controller_impls/url_controller.rs
index fd151ea9c0..590e2eb82a 100644
--- a/frontend/rust-lib/flowy-database/src/services/group/controller_impls/url_controller.rs
+++ b/frontend/rust-lib/flowy-database/src/services/group/controller_impls/url_controller.rs
@@ -197,6 +197,7 @@ impl GroupGenerator for URLGroupGenerator {
let group_configs = cells
.into_iter()
.flat_map(|value| value.into_url_field_cell_data())
+ .filter(|cell| !cell.content.is_empty())
.map(|cell| GeneratedGroupConfig {
group_rev: make_group_from_url_cell(&cell),
filter_content: cell.content,