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: clear cells not working (#7956)

Richard Shiuef5e2e4e915ea
diff --git a/frontend/appflowy_flutter/integration_test/desktop/database/database_field_test.dart b/frontend/appflowy_flutter/integration_test/desktop/database/database_field_test.dart
index 6ce248a8a1..8f49fc287a 100644
--- a/frontend/appflowy_flutter/integration_test/desktop/database/database_field_test.dart
+++ b/frontend/appflowy_flutter/integration_test/desktop/database/database_field_test.dart
@@ -168,6 +168,38 @@ void main() {
await tester.pumpAndSettle();
});
+ testWidgets('clear cells under field', (tester) async {
+ await tester.initializeAppFlowy();
+ await tester.tapAnonymousSignInButton();
+
+ await tester.createNewPageWithNameUnderParent(layout: ViewLayoutPB.Grid);
+
+ await tester.scrollToRight(find.byType(GridPage));
+
+ // edit the data
+ await tester.editCell(
+ rowIndex: 0,
+ fieldType: FieldType.RichText,
+ input: 'Hello',
+ );
+ await tester.editCell(
+ rowIndex: 1,
+ fieldType: FieldType.RichText,
+ input: 'World',
+ );
+
+ expect(find.text('Hello'), findsOneWidget);
+ expect(find.text('World'), findsOneWidget);
+
+ // clear the cells
+ await tester.tapGridFieldWithName('Name');
+ await tester.tapClearCellsButton();
+ await tester.tapButtonWithName(LocaleKeys.button_confirm.tr());
+
+ expect(find.text('Hello'), findsNothing);
+ expect(find.text('World'), findsNothing);
+ });
+
testWidgets('create list of fields', (tester) async {
await tester.initializeAppFlowy();
await tester.tapAnonymousSignInButton();
diff --git a/frontend/appflowy_flutter/integration_test/shared/database_test_op.dart b/frontend/appflowy_flutter/integration_test/shared/database_test_op.dart
index 970965f294..507260156e 100644
--- a/frontend/appflowy_flutter/integration_test/shared/database_test_op.dart
+++ b/frontend/appflowy_flutter/integration_test/shared/database_test_op.dart
@@ -836,6 +836,14 @@ extension AppFlowyDatabaseTest on WidgetTester {
await tapButton(button);
}
+ Future<void> tapClearCellsButton() async {
+ final field = find.byWidgetPredicate(
+ (widget) =>
+ widget is FieldActionCell && widget.action == FieldAction.clearData,
+ );
+ await tapButton(field);
+ }
+
Future<void> tapRowDetailPageRowActionButton() async =>
tapButton(find.byType(RowActionButton));
diff --git a/frontend/rust-lib/Cargo.lock b/frontend/rust-lib/Cargo.lock
index 76baaf1091..80aa17450c 100644
--- a/frontend/rust-lib/Cargo.lock
+++ b/frontend/rust-lib/Cargo.lock
@@ -971,7 +971,7 @@ dependencies = [
[[package]]
name = "collab"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=8cad313d87af611f225df8b222fb744f279ef4d6#8cad313d87af611f225df8b222fb744f279ef4d6"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4dfccef#4dfccefb9e4fd35240107b93fb4b5966295b452e"
dependencies = [
"anyhow",
"arc-swap",
@@ -996,7 +996,7 @@ dependencies = [
[[package]]
name = "collab-database"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=8cad313d87af611f225df8b222fb744f279ef4d6#8cad313d87af611f225df8b222fb744f279ef4d6"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4dfccef#4dfccefb9e4fd35240107b93fb4b5966295b452e"
dependencies = [
"anyhow",
"async-trait",
@@ -1036,7 +1036,7 @@ dependencies = [
[[package]]
name = "collab-document"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=8cad313d87af611f225df8b222fb744f279ef4d6#8cad313d87af611f225df8b222fb744f279ef4d6"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4dfccef#4dfccefb9e4fd35240107b93fb4b5966295b452e"
dependencies = [
"anyhow",
"arc-swap",
@@ -1057,7 +1057,7 @@ dependencies = [
[[package]]
name = "collab-entity"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=8cad313d87af611f225df8b222fb744f279ef4d6#8cad313d87af611f225df8b222fb744f279ef4d6"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4dfccef#4dfccefb9e4fd35240107b93fb4b5966295b452e"
dependencies = [
"anyhow",
"bytes",
@@ -1077,7 +1077,7 @@ dependencies = [
[[package]]
name = "collab-folder"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=8cad313d87af611f225df8b222fb744f279ef4d6#8cad313d87af611f225df8b222fb744f279ef4d6"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4dfccef#4dfccefb9e4fd35240107b93fb4b5966295b452e"
dependencies = [
"anyhow",
"arc-swap",
@@ -1099,7 +1099,7 @@ dependencies = [
[[package]]
name = "collab-importer"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=8cad313d87af611f225df8b222fb744f279ef4d6#8cad313d87af611f225df8b222fb744f279ef4d6"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4dfccef#4dfccefb9e4fd35240107b93fb4b5966295b452e"
dependencies = [
"anyhow",
"async-recursion",
@@ -1162,7 +1162,7 @@ dependencies = [
[[package]]
name = "collab-plugins"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=8cad313d87af611f225df8b222fb744f279ef4d6#8cad313d87af611f225df8b222fb744f279ef4d6"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4dfccef#4dfccefb9e4fd35240107b93fb4b5966295b452e"
dependencies = [
"anyhow",
"async-stream",
@@ -1239,7 +1239,7 @@ dependencies = [
[[package]]
name = "collab-user"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=8cad313d87af611f225df8b222fb744f279ef4d6#8cad313d87af611f225df8b222fb744f279ef4d6"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4dfccef#4dfccefb9e4fd35240107b93fb4b5966295b452e"
dependencies = [
"anyhow",
"collab",
diff --git a/frontend/rust-lib/Cargo.toml b/frontend/rust-lib/Cargo.toml
index becacf22e5..6b4893b1d8 100644
--- a/frontend/rust-lib/Cargo.toml
+++ b/frontend/rust-lib/Cargo.toml
@@ -147,13 +147,13 @@ rocksdb = { git = "https://github.com/rust-rocksdb/rust-rocksdb", rev = "1710120
# To switch to the local path, run:
# scripts/tool/update_collab_source.sh
# ⚠️⚠️⚠️️
-collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "8cad313d87af611f225df8b222fb744f279ef4d6" }
-collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "8cad313d87af611f225df8b222fb744f279ef4d6" }
-collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "8cad313d87af611f225df8b222fb744f279ef4d6" }
-collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "8cad313d87af611f225df8b222fb744f279ef4d6" }
-collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "8cad313d87af611f225df8b222fb744f279ef4d6" }
-collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "8cad313d87af611f225df8b222fb744f279ef4d6" }
-collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "8cad313d87af611f225df8b222fb744f279ef4d6" }
-collab-importer = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "8cad313d87af611f225df8b222fb744f279ef4d6" }
+collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4dfccef" }
+collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4dfccef" }
+collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4dfccef" }
+collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4dfccef" }
+collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4dfccef" }
+collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4dfccef" }
+collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4dfccef" }
+collab-importer = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4dfccef" }
langchain-rust = { version = "4.6.0", git = "https://github.com/appflowy/langchain-rust", branch = "af" }
diff --git a/frontend/rust-lib/flowy-database2/src/services/database/database_editor.rs b/frontend/rust-lib/flowy-database2/src/services/database/database_editor.rs
index db9a358daf..8e3b9dbf49 100644
--- a/frontend/rust-lib/flowy-database2/src/services/database/database_editor.rs
+++ b/frontend/rust-lib/flowy-database2/src/services/database/database_editor.rs
@@ -1039,9 +1039,11 @@ impl DatabaseEditor {
let old_row = self.get_row(view_id, &row_id).await;
self
.update_row(row_id.clone(), |row_update| {
- row_update.update_cells(|cell_update| {
- cell_update.clear(field_id);
- });
+ row_update
+ .set_last_modified(timestamp())
+ .update_cells(|cell_update| {
+ cell_update.clear(field_id);
+ });
})
.await?;