diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/cell/cell_controller.dart b/frontend/appflowy_flutter/lib/plugins/database/application/cell/cell_controller.dart index 858acadc5a..51c372fb6e 100644 --- a/frontend/appflowy_flutter/lib/plugins/database/application/cell/cell_controller.dart +++ b/frontend/appflowy_flutter/lib/plugins/database/application/cell/cell_controller.dart @@ -89,6 +89,15 @@ class CellController { fieldId: _cellContext.fieldId, ); + _rowCache.addListener( + rowId: rowId, + onRowChanged: (context, reason) { + if (reason == const ChangedReason.didFetchRow()) { + _onRowMetaChanged?.call(); + } + }, + ); + // 1. Listen on user edit event and load the new cell data if needed. // For example: // user input: 12 diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/row/row_controller.dart b/frontend/appflowy_flutter/lib/plugins/database/application/row/row_controller.dart index 230c482f48..1ba336b321 100644 --- a/frontend/appflowy_flutter/lib/plugins/database/application/row/row_controller.dart +++ b/frontend/appflowy_flutter/lib/plugins/database/application/row/row_controller.dart @@ -1,3 +1,5 @@ +import 'dart:async'; + import 'package:appflowy/plugins/database/application/row/row_service.dart'; import 'package:appflowy/plugins/database/domain/row_listener.dart'; import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart'; @@ -38,6 +40,25 @@ class RowController { Future initialize() async { await _rowBackendSvc.initRow(rowMeta.id); + unawaited( + _rowBackendSvc.getRowMeta(rowId).then( + (result) { + if (_isDisposed) { + return; + } + + result.fold( + (rowMeta) { + _rowMeta = rowMeta; + _rowCache.setRowMeta(rowMeta); + _onRowMetaChanged?.call(); + }, + (error) => debugPrint(error.toString()), + ); + }, + ), + ); + _rowListener.start( onRowFetched: (DidFetchRowPB row) { _rowCache.setRowMeta(row.meta); diff --git a/frontend/appflowy_tauri/src-tauri/Cargo.lock b/frontend/appflowy_tauri/src-tauri/Cargo.lock index 50f3914a2b..6ccda20d20 100644 --- a/frontend/appflowy_tauri/src-tauri/Cargo.lock +++ b/frontend/appflowy_tauri/src-tauri/Cargo.lock @@ -172,7 +172,7 @@ checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "app-error" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f" dependencies = [ "anyhow", "bincode", @@ -192,7 +192,7 @@ dependencies = [ [[package]] name = "appflowy-ai-client" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f" dependencies = [ "anyhow", "bytes", @@ -826,7 +826,7 @@ dependencies = [ [[package]] name = "client-api" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f" dependencies = [ "again", "anyhow", @@ -877,7 +877,7 @@ dependencies = [ [[package]] name = "client-api-entity" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f" dependencies = [ "collab-entity", "collab-rt-entity", @@ -890,7 +890,7 @@ dependencies = [ [[package]] name = "client-websocket" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f" dependencies = [ "futures-channel", "futures-util", @@ -964,7 +964,7 @@ dependencies = [ [[package]] name = "collab" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362" dependencies = [ "anyhow", "arc-swap", @@ -989,7 +989,7 @@ dependencies = [ [[package]] name = "collab-database" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362" dependencies = [ "anyhow", "async-trait", @@ -1018,7 +1018,7 @@ dependencies = [ [[package]] name = "collab-document" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362" dependencies = [ "anyhow", "arc-swap", @@ -1038,7 +1038,7 @@ dependencies = [ [[package]] name = "collab-entity" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362" dependencies = [ "anyhow", "bytes", @@ -1057,7 +1057,7 @@ dependencies = [ [[package]] name = "collab-folder" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362" dependencies = [ "anyhow", "arc-swap", @@ -1100,7 +1100,7 @@ dependencies = [ [[package]] name = "collab-plugins" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362" dependencies = [ "anyhow", "async-stream", @@ -1138,7 +1138,7 @@ dependencies = [ [[package]] name = "collab-rt-entity" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f" dependencies = [ "anyhow", "bincode", @@ -1163,7 +1163,7 @@ dependencies = [ [[package]] name = "collab-rt-protocol" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f" dependencies = [ "anyhow", "async-trait", @@ -1180,7 +1180,7 @@ dependencies = [ [[package]] name = "collab-user" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362" dependencies = [ "anyhow", "collab", @@ -1551,7 +1551,7 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" [[package]] name = "database-entity" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f" dependencies = [ "anyhow", "app-error", @@ -3076,7 +3076,7 @@ dependencies = [ [[package]] name = "gotrue" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f" dependencies = [ "anyhow", "futures-util", @@ -3093,7 +3093,7 @@ dependencies = [ [[package]] name = "gotrue-entity" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f" dependencies = [ "anyhow", "app-error", @@ -3525,7 +3525,7 @@ dependencies = [ [[package]] name = "infra" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f" dependencies = [ "anyhow", "bytes", @@ -6122,7 +6122,7 @@ dependencies = [ [[package]] name = "shared-entity" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f" dependencies = [ "anyhow", "app-error", diff --git a/frontend/appflowy_tauri/src-tauri/Cargo.toml b/frontend/appflowy_tauri/src-tauri/Cargo.toml index 59591a566d..6ccf03439c 100644 --- a/frontend/appflowy_tauri/src-tauri/Cargo.toml +++ b/frontend/appflowy_tauri/src-tauri/Cargo.toml @@ -53,7 +53,7 @@ collab-user = { version = "0.2" } # Run the script: # scripts/tool/update_client_api_rev.sh new_rev_id # ⚠️⚠️⚠️️ -client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "50e6a41513348f42a441c9c4f90220fcec2ba2ca" } +client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "8cc410ce6542855b89f98f4c278049b7d679eb8f" } [dependencies] serde_json.workspace = true @@ -116,13 +116,13 @@ custom-protocol = ["tauri/custom-protocol"] # 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 = "f747496df74b61bccfa25eaefae161a331f71f96" } -collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f747496df74b61bccfa25eaefae161a331f71f96" } -collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f747496df74b61bccfa25eaefae161a331f71f96" } -collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f747496df74b61bccfa25eaefae161a331f71f96" } -collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f747496df74b61bccfa25eaefae161a331f71f96" } -collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f747496df74b61bccfa25eaefae161a331f71f96" } -collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f747496df74b61bccfa25eaefae161a331f71f96" } +collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" } +collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" } +collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" } +collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" } +collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" } +collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" } +collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" } # Working directory: frontend # To update the commit ID, run: diff --git a/frontend/appflowy_web_app/src-tauri/Cargo.lock b/frontend/appflowy_web_app/src-tauri/Cargo.lock index cddb658ede..23702a27ac 100644 --- a/frontend/appflowy_web_app/src-tauri/Cargo.lock +++ b/frontend/appflowy_web_app/src-tauri/Cargo.lock @@ -163,7 +163,7 @@ checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "app-error" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f" dependencies = [ "anyhow", "bincode", @@ -183,7 +183,7 @@ dependencies = [ [[package]] name = "appflowy-ai-client" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f" dependencies = [ "anyhow", "bytes", @@ -800,7 +800,7 @@ dependencies = [ [[package]] name = "client-api" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f" dependencies = [ "again", "anyhow", @@ -851,7 +851,7 @@ dependencies = [ [[package]] name = "client-api-entity" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f" dependencies = [ "collab-entity", "collab-rt-entity", @@ -864,7 +864,7 @@ dependencies = [ [[package]] name = "client-websocket" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f" dependencies = [ "futures-channel", "futures-util", @@ -947,7 +947,7 @@ dependencies = [ [[package]] name = "collab" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362" dependencies = [ "anyhow", "arc-swap", @@ -972,7 +972,7 @@ dependencies = [ [[package]] name = "collab-database" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362" dependencies = [ "anyhow", "async-trait", @@ -1001,7 +1001,7 @@ dependencies = [ [[package]] name = "collab-document" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362" dependencies = [ "anyhow", "arc-swap", @@ -1021,7 +1021,7 @@ dependencies = [ [[package]] name = "collab-entity" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362" dependencies = [ "anyhow", "bytes", @@ -1040,7 +1040,7 @@ dependencies = [ [[package]] name = "collab-folder" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362" dependencies = [ "anyhow", "arc-swap", @@ -1083,7 +1083,7 @@ dependencies = [ [[package]] name = "collab-plugins" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362" dependencies = [ "anyhow", "async-stream", @@ -1121,7 +1121,7 @@ dependencies = [ [[package]] name = "collab-rt-entity" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f" dependencies = [ "anyhow", "bincode", @@ -1146,7 +1146,7 @@ dependencies = [ [[package]] name = "collab-rt-protocol" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f" dependencies = [ "anyhow", "async-trait", @@ -1163,7 +1163,7 @@ dependencies = [ [[package]] name = "collab-user" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362" dependencies = [ "anyhow", "collab", @@ -1541,7 +1541,7 @@ checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" [[package]] name = "database-entity" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f" dependencies = [ "anyhow", "app-error", @@ -3143,7 +3143,7 @@ dependencies = [ [[package]] name = "gotrue" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f" dependencies = [ "anyhow", "futures-util", @@ -3160,7 +3160,7 @@ dependencies = [ [[package]] name = "gotrue-entity" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f" dependencies = [ "anyhow", "app-error", @@ -3597,7 +3597,7 @@ dependencies = [ [[package]] name = "infra" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f" dependencies = [ "anyhow", "bytes", @@ -6186,7 +6186,7 @@ dependencies = [ [[package]] name = "shared-entity" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f" dependencies = [ "anyhow", "app-error", diff --git a/frontend/appflowy_web_app/src-tauri/Cargo.toml b/frontend/appflowy_web_app/src-tauri/Cargo.toml index 22c8b60bfb..95c37548a9 100644 --- a/frontend/appflowy_web_app/src-tauri/Cargo.toml +++ b/frontend/appflowy_web_app/src-tauri/Cargo.toml @@ -52,7 +52,7 @@ collab-user = { version = "0.2" } # Run the script: # scripts/tool/update_client_api_rev.sh new_rev_id # ⚠️⚠️⚠️️ -client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "50e6a41513348f42a441c9c4f90220fcec2ba2ca" } +client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "8cc410ce6542855b89f98f4c278049b7d679eb8f" } [dependencies] serde_json.workspace = true @@ -116,13 +116,13 @@ custom-protocol = ["tauri/custom-protocol"] # 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 = "f747496df74b61bccfa25eaefae161a331f71f96" } -collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f747496df74b61bccfa25eaefae161a331f71f96" } -collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f747496df74b61bccfa25eaefae161a331f71f96" } -collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f747496df74b61bccfa25eaefae161a331f71f96" } -collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f747496df74b61bccfa25eaefae161a331f71f96" } -collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f747496df74b61bccfa25eaefae161a331f71f96" } -collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f747496df74b61bccfa25eaefae161a331f71f96" } +collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" } +collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" } +collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" } +collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" } +collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" } +collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" } +collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" } # Working directory: frontend # To update the commit ID, run: diff --git a/frontend/rust-lib/Cargo.lock b/frontend/rust-lib/Cargo.lock index a85601a96e..76cac5197c 100644 --- a/frontend/rust-lib/Cargo.lock +++ b/frontend/rust-lib/Cargo.lock @@ -163,7 +163,7 @@ checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "app-error" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f" dependencies = [ "anyhow", "bincode", @@ -183,7 +183,7 @@ dependencies = [ [[package]] name = "appflowy-ai-client" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f" dependencies = [ "anyhow", "bytes", @@ -718,7 +718,7 @@ dependencies = [ [[package]] name = "client-api" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f" dependencies = [ "again", "anyhow", @@ -769,7 +769,7 @@ dependencies = [ [[package]] name = "client-api-entity" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f" dependencies = [ "collab-entity", "collab-rt-entity", @@ -782,7 +782,7 @@ dependencies = [ [[package]] name = "client-websocket" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f" dependencies = [ "futures-channel", "futures-util", @@ -825,7 +825,7 @@ dependencies = [ [[package]] name = "collab" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362" dependencies = [ "anyhow", "arc-swap", @@ -850,7 +850,7 @@ dependencies = [ [[package]] name = "collab-database" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362" dependencies = [ "anyhow", "async-trait", @@ -879,7 +879,7 @@ dependencies = [ [[package]] name = "collab-document" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362" dependencies = [ "anyhow", "arc-swap", @@ -899,7 +899,7 @@ dependencies = [ [[package]] name = "collab-entity" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362" dependencies = [ "anyhow", "bytes", @@ -918,7 +918,7 @@ dependencies = [ [[package]] name = "collab-folder" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362" dependencies = [ "anyhow", "arc-swap", @@ -961,7 +961,7 @@ dependencies = [ [[package]] name = "collab-plugins" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362" dependencies = [ "anyhow", "async-stream", @@ -999,7 +999,7 @@ dependencies = [ [[package]] name = "collab-rt-entity" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f" dependencies = [ "anyhow", "bincode", @@ -1024,7 +1024,7 @@ dependencies = [ [[package]] name = "collab-rt-protocol" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f" dependencies = [ "anyhow", "async-trait", @@ -1041,7 +1041,7 @@ dependencies = [ [[package]] name = "collab-user" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362" dependencies = [ "anyhow", "collab", @@ -1375,7 +1375,7 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" [[package]] name = "database-entity" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f" dependencies = [ "anyhow", "app-error", @@ -2754,7 +2754,7 @@ dependencies = [ [[package]] name = "gotrue" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f" dependencies = [ "anyhow", "futures-util", @@ -2771,7 +2771,7 @@ dependencies = [ [[package]] name = "gotrue-entity" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f" dependencies = [ "anyhow", "app-error", @@ -3136,7 +3136,7 @@ dependencies = [ [[package]] name = "infra" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f" dependencies = [ "anyhow", "bytes", @@ -5344,7 +5344,7 @@ dependencies = [ [[package]] name = "shared-entity" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f" dependencies = [ "anyhow", "app-error", diff --git a/frontend/rust-lib/Cargo.toml b/frontend/rust-lib/Cargo.toml index 00735eaa35..54e9c6e2a6 100644 --- a/frontend/rust-lib/Cargo.toml +++ b/frontend/rust-lib/Cargo.toml @@ -100,8 +100,8 @@ dashmap = "6.0.1" # Run the script.add_workspace_members: # scripts/tool/update_client_api_rev.sh new_rev_id # ⚠️⚠️⚠️️ -client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "50e6a41513348f42a441c9c4f90220fcec2ba2ca" } -client-api-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "50e6a41513348f42a441c9c4f90220fcec2ba2ca" } +client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "8cc410ce6542855b89f98f4c278049b7d679eb8f" } +client-api-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "8cc410ce6542855b89f98f4c278049b7d679eb8f" } [profile.dev] opt-level = 0 @@ -136,13 +136,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 = "f747496df74b61bccfa25eaefae161a331f71f96" } -collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f747496df74b61bccfa25eaefae161a331f71f96" } -collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f747496df74b61bccfa25eaefae161a331f71f96" } -collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f747496df74b61bccfa25eaefae161a331f71f96" } -collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f747496df74b61bccfa25eaefae161a331f71f96" } -collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f747496df74b61bccfa25eaefae161a331f71f96" } -collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f747496df74b61bccfa25eaefae161a331f71f96" } +collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" } +collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" } +collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" } +collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" } +collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" } +collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" } +collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" } # Working directory: frontend # To update the commit ID, run: diff --git a/frontend/rust-lib/collab-integrate/src/collab_builder.rs b/frontend/rust-lib/collab-integrate/src/collab_builder.rs index 9ae4856142..697a0467d3 100644 --- a/frontend/rust-lib/collab-integrate/src/collab_builder.rs +++ b/frontend/rust-lib/collab-integrate/src/collab_builder.rs @@ -162,14 +162,6 @@ impl AppFlowyCollabBuilder { collab.enable_undo_redo(); let document = Document::open_with(collab, data)?; - self.flush_collab_if_not_exist( - object.uid, - &object.object_id, - collab_db.clone(), - &expected_collab_type, - &document, - )?; - let document = Arc::new(RwLock::new(document)); self.finalize(object, builder_config, document) } @@ -192,15 +184,6 @@ impl AppFlowyCollabBuilder { assert_eq!(object.collab_type, expected_collab_type); let collab = self.build_collab(&object, &collab_db, doc_state)?; let folder = Folder::open_with(object.uid, collab, folder_notifier, folder_data); - - self.flush_collab_if_not_exist( - object.uid, - &object.object_id, - collab_db.clone(), - &expected_collab_type, - &folder, - )?; - let folder = Arc::new(RwLock::new(folder)); self.finalize(object, builder_config, folder) } @@ -222,15 +205,6 @@ impl AppFlowyCollabBuilder { assert_eq!(object.collab_type, expected_collab_type); let collab = self.build_collab(&object, &collab_db, doc_state)?; let user_awareness = UserAwareness::open(collab, notifier); - - self.flush_collab_if_not_exist( - object.uid, - &object.object_id, - collab_db.clone(), - &expected_collab_type, - &user_awareness, - )?; - let user_awareness = Arc::new(RwLock::new(user_awareness)); self.finalize(object, builder_config, user_awareness) } @@ -241,22 +215,13 @@ impl AppFlowyCollabBuilder { &self, object: CollabObject, collab: Collab, - collab_db: Weak, + _collab_db: Weak, builder_config: CollabBuilderConfig, collab_service: impl DatabaseCollabService, ) -> Result>, Error> { let expected_collab_type = CollabType::WorkspaceDatabase; assert_eq!(object.collab_type, expected_collab_type); - let workspace = WorkspaceDatabase::open(collab, collab_service); - - self.flush_collab_if_not_exist( - object.uid, - &object.object_id, - collab_db.clone(), - &expected_collab_type, - &workspace, - )?; - + let workspace = WorkspaceDatabase::open(&object.object_id, collab, collab_service); let workspace = Arc::new(RwLock::new(workspace)); self.finalize(object, builder_config, workspace) } @@ -267,7 +232,7 @@ impl AppFlowyCollabBuilder { collab_db: &Weak, data_source: DataSource, ) -> Result { - let collab = CollabBuilder::new(object.uid, &object.object_id, data_source) + let mut collab = CollabBuilder::new(object.uid, &object.object_id, data_source) .with_device_id(self.workspace_integrate.device_id()?) .build()?; @@ -280,7 +245,7 @@ impl AppFlowyCollabBuilder { persistence_config.clone(), ); collab.add_plugin(Box::new(db_plugin)); - + collab.initialize(); Ok(collab) } @@ -293,43 +258,34 @@ impl AppFlowyCollabBuilder { where T: BorrowMut + Send + Sync + 'static, { - if !build_config.sync_enable { - return Ok(collab); - } - let mut write_collab = collab.try_write()?; - if !write_collab.borrow().get_state().is_uninitialized() { - warn!("{} is already initialized", object); - drop(write_collab); - return Ok(collab); - } + if build_config.sync_enable { + trace!("🚀finalize collab:{}", object); + let plugin_provider = self.plugin_provider.load_full(); + let provider_type = plugin_provider.provider_type(); + let span = + tracing::span!(tracing::Level::TRACE, "collab_builder", object_id = %object.object_id); + let _enter = span.enter(); + match provider_type { + CollabPluginProviderType::AppFlowyCloud => { + let local_collab = Arc::downgrade(&collab); + let plugins = plugin_provider.get_plugins(CollabPluginProviderContext::AppFlowyCloud { + uid: object.uid, + collab_object: object, + local_collab, + }); - trace!("🚀finalize collab:{}", object); - let plugin_provider = self.plugin_provider.load_full(); - let provider_type = plugin_provider.provider_type(); - let span = - tracing::span!(tracing::Level::TRACE, "collab_builder", object_id = %object.object_id); - let _enter = span.enter(); - match provider_type { - CollabPluginProviderType::AppFlowyCloud => { - let local_collab = Arc::downgrade(&collab); - let plugins = plugin_provider.get_plugins(CollabPluginProviderContext::AppFlowyCloud { - uid: object.uid, - collab_object: object, - local_collab, - }); - - // at the moment when we get the lock, the collab object is not yet exposed outside - for plugin in plugins { - write_collab.borrow().add_plugin(plugin); - } - }, - CollabPluginProviderType::Local => {}, + // at the moment when we get the lock, the collab object is not yet exposed outside + for plugin in plugins { + write_collab.borrow().add_plugin(plugin); + } + }, + CollabPluginProviderType::Local => {}, + } } (*write_collab).borrow_mut().initialize(); drop(write_collab); - Ok(collab) } @@ -349,17 +305,17 @@ impl AppFlowyCollabBuilder { let write_txn = collab_db.write_txn(); let is_not_exist_on_disk = !write_txn.is_exist(uid, object_id); if is_not_exist_on_disk { - trace!("flush collab:{}-{} to disk", collab_type, object_id); + trace!("flush collab:{}-{}-{} to disk", uid, collab_type, object_id); let collab: &Collab = collab.borrow(); let encode_collab = collab.encode_collab_v1(|collab| collab_type.validate_require_data(collab))?; - write_txn.flush_doc( uid, object_id, encode_collab.state_vector.to_vec(), encode_collab.doc_state.to_vec(), )?; + write_txn.commit_transaction()?; } } diff --git a/frontend/rust-lib/event-integration-test/tests/document/af_cloud_test/edit_test.rs b/frontend/rust-lib/event-integration-test/tests/document/af_cloud_test/edit_test.rs index 50a8fd3fd8..c519b14706 100644 --- a/frontend/rust-lib/event-integration-test/tests/document/af_cloud_test/edit_test.rs +++ b/frontend/rust-lib/event-integration-test/tests/document/af_cloud_test/edit_test.rs @@ -31,7 +31,7 @@ async fn af_cloud_edit_document_test() { let rx = test .notification_sender .subscribe_with_condition::(&document_id, |pb| { - pb.value != DocumentSyncState::Syncing + pb.value == DocumentSyncState::SyncFinished }); let _ = receive_with_timeout(rx, Duration::from_secs(30)).await; diff --git a/frontend/rust-lib/flowy-database2/src/entities/row_entities.rs b/frontend/rust-lib/flowy-database2/src/entities/row_entities.rs index 705884c3ee..3d71864746 100644 --- a/frontend/rust-lib/flowy-database2/src/entities/row_entities.rs +++ b/frontend/rust-lib/flowy-database2/src/entities/row_entities.rs @@ -98,7 +98,7 @@ impl From for RowMetaPB { } } -impl std::convert::From for RowMetaPB { +impl From for RowMetaPB { fn from(row_detail: RowDetail) -> Self { Self { id: row_detail.row.id.to_string(), diff --git a/frontend/rust-lib/flowy-database2/src/manager.rs b/frontend/rust-lib/flowy-database2/src/manager.rs index 53e42b6d8f..db37387451 100644 --- a/frontend/rust-lib/flowy-database2/src/manager.rs +++ b/frontend/rust-lib/flowy-database2/src/manager.rs @@ -762,20 +762,31 @@ impl DatabaseCollabService for WorkspaceDatabaseCollabServiceImpl { let data_source: DataSource = if is_new { DataSource::Disk(None) } else if self.persistence.is_collab_exist(object_id) { + trace!("build collab: load {}:{} from disk", collab_type, object_id); CollabPersistenceImpl { persistence: Some(self.persistence.clone()), } .into() } else { - match self.get_encode_collab(object_id, collab_type).await { + trace!( + "build collab: fetch {}:{} from remote", + collab_type, + object_id + ); + match self.get_encode_collab(object_id, collab_type.clone()).await { Ok(Some(encode_collab)) => { - self - .persistence - .flush_collab(object_id, encode_collab.clone()) - .map_err(|err| DatabaseError::Internal(anyhow!("Failed to flush collab: {}", err)))?; + trace!( + "build collab: {}:{} with remote encode collab", + collab_type, + object_id + ); DataSource::from(encode_collab) }, Ok(None) => { + info!( + "build collab: {}:{} with empty encode collab", + collab_type, object_id + ); // when collab not exist, create a default collab CollabPersistenceImpl { persistence: Some(self.persistence.clone()), @@ -783,7 +794,7 @@ impl DatabaseCollabService for WorkspaceDatabaseCollabServiceImpl { .into() }, Err(err) => { - error!("Failed to get encode collab: {}", err); + error!("build collab: failed to get encode collab: {}", err); return Err(err); }, } @@ -825,7 +836,7 @@ impl DatabaseCollabPersistenceService for DatabasePersistenceImpl { return; } - trace!("[Database]: start loading collab:{}", object_id); + trace!("[Database]: start loading collab:{} from disk", object_id); let mut txn = collab.transact_mut(); match db_read.load_doc_with_txn(uid, &object_id, &mut txn) { Ok(update_count) => { @@ -881,12 +892,12 @@ impl DatabaseCollabPersistenceService for DatabasePersistenceImpl { object_id: &str, encode_collab: EncodedCollab, ) -> Result<(), DatabaseError> { - trace!("[Database]: flush collab:{}", object_id); let uid = self .user .user_id() .map_err(|err| DatabaseError::Internal(err.into()))?; if let Ok(Some(collab_db)) = self.user.collab_db(uid).map(|weak| weak.upgrade()) { + trace!("[Database]: flush collab:{}", object_id); let write_txn = collab_db.write_txn(); write_txn .flush_doc( diff --git a/frontend/rust-lib/flowy-database2/src/notification.rs b/frontend/rust-lib/flowy-database2/src/notification.rs index eadaa7e031..227ea74a2a 100644 --- a/frontend/rust-lib/flowy-database2/src/notification.rs +++ b/frontend/rust-lib/flowy-database2/src/notification.rs @@ -91,5 +91,8 @@ impl std::convert::From for DatabaseNotification { #[tracing::instrument(level = "trace")] pub fn send_notification(id: &str, ty: DatabaseNotification) -> NotificationBuilder { + #[cfg(feature = "verbose_log")] + trace!("[Database Notification]: id:{}, ty:{:?}", id, ty); + NotificationBuilder::new(id, ty, DATABASE_OBSERVABLE_SOURCE) } 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 48b018fbfd..0b8ae12030 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 @@ -31,6 +31,7 @@ use collab_database::views::{ }; use collab_entity::CollabType; use collab_integrate::collab_builder::{AppFlowyCollabBuilder, CollabBuilderConfig}; +use dashmap::DashMap; use flowy_error::{internal_error, ErrorCode, FlowyError, FlowyResult}; use flowy_notification::DebounceNotificationSender; use lib_infra::box_any::BoxAny; @@ -58,6 +59,7 @@ pub struct DatabaseEditor { is_opening: ArcSwap, opening_ret_txs: Arc>>, database_cancellation: Arc>>, + finalized_rows: Arc>, } impl DatabaseEditor { @@ -120,6 +122,7 @@ impl DatabaseEditor { is_opening: Default::default(), opening_ret_txs: Arc::new(Default::default()), database_cancellation, + finalized_rows: Arc::new(Default::default()), }); observe_block_event(&database_id, &this).await; Ok(this) @@ -699,18 +702,13 @@ impl DatabaseEditor { } pub async fn init_database_row(&self, row_id: &RowId) -> FlowyResult<()> { - if let Some(database_row) = self.database.read().await.get_database_row(row_id) { - if !database_row - .read() - .await - .collab - .get_state() - .is_uninitialized() - { + if let Some(entry) = self.finalized_rows.get(row_id) { + if *entry.value() { return Ok(()); } } + self.finalized_rows.insert(row_id.clone(), true); debug!("Init database row: {}", row_id); let database_row = self .database diff --git a/frontend/rust-lib/flowy-server/src/af_cloud/impls/database.rs b/frontend/rust-lib/flowy-server/src/af_cloud/impls/database.rs index 7ecebac485..a7f3e716e9 100644 --- a/frontend/rust-lib/flowy-server/src/af_cloud/impls/database.rs +++ b/frontend/rust-lib/flowy-server/src/af_cloud/impls/database.rs @@ -32,7 +32,8 @@ impl DatabaseCloudService for AFCloudDatabaseCloudServiceImpl where T: AFServer, { - #[instrument(level = "debug", skip_all)] + #[instrument(level = "debug", skip_all, err)] + #[allow(clippy::blocks_in_conditions)] async fn get_database_encode_collab( &self, object_id: &str, diff --git a/frontend/rust-lib/flowy-user/src/services/data_import/importer.rs b/frontend/rust-lib/flowy-user/src/services/data_import/importer.rs index be2712827f..0fed9cd9d4 100644 --- a/frontend/rust-lib/flowy-user/src/services/data_import/importer.rs +++ b/frontend/rust-lib/flowy-user/src/services/data_import/importer.rs @@ -15,7 +15,6 @@ where PersistenceError: From, { let mut collab_by_oid = HashMap::new(); - for object_id in object_ids { match load_collab_by_object_id(uid, collab_read_txn, object_id) { Ok(collab) => {