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.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
fix: options don't refresh after moving the card (#1536)
Nathan.foooa2f9ca2f28bb
diff --git a/frontend/app_flowy/lib/plugins/grid/application/row/row_cache.dart b/frontend/app_flowy/lib/plugins/grid/application/row/row_cache.dartindex 07e426b385..0a920639a9 100644--- a/frontend/app_flowy/lib/plugins/grid/application/row/row_cache.dart+++ b/frontend/app_flowy/lib/plugins/grid/application/row/row_cache.dart@@ -97,11 +97,22 @@ class GridRowCache {}}- void _updateRows(List<RowPB> updatedRows) {+ void _updateRows(List<UpdatedRowPB> updatedRows) {if (updatedRows.isEmpty) return;+ List<RowPB> rowPBs = [];+ for (final updatedRow in updatedRows) {+ for (final fieldId in updatedRow.fieldIds) {+ final key = GridCellCacheKey(+ fieldId: fieldId,+ rowId: updatedRow.row.id,+ );+ _cellCache.remove(key);+ }+ rowPBs.add(updatedRow.row);+ }final updatedIndexs =- _rowList.updateRows(updatedRows, (rowPB) => buildGridRow(rowPB));+ _rowList.updateRows(rowPBs, (rowPB) => buildGridRow(rowPB));if (updatedIndexs.isNotEmpty) {_rowChangeReasonNotifier.receive(RowsChangedReason.update(updatedIndexs));}diff --git a/frontend/app_flowy/lib/plugins/grid/presentation/widgets/row/row_detail.dart b/frontend/app_flowy/lib/plugins/grid/presentation/widgets/row/row_detail.dartindex fc090eb914..c13ddf28ba 100644--- a/frontend/app_flowy/lib/plugins/grid/presentation/widgets/row/row_detail.dart+++ b/frontend/app_flowy/lib/plugins/grid/presentation/widgets/row/row_detail.dart@@ -114,7 +114,7 @@ class _PropertyList extends StatelessWidget {builder: (context, state) {return Column(children: [- Expanded(child: _wrapScrollbar(buildList(state))),+ Expanded(child: _wrapScrollbar(buildRowCells(state))),const VSpace(10),_CreateFieldButton(viewId: viewId,@@ -126,7 +126,7 @@ class _PropertyList extends StatelessWidget {);}- Widget buildList(RowDetailState state) {+ Widget buildRowCells(RowDetailState state) {return ListView.separated(controller: _scrollController,itemCount: state.gridCells.length,diff --git a/frontend/rust-lib/flowy-grid/src/entities/block_entities.rs b/frontend/rust-lib/flowy-grid/src/entities/block_entities.rsindex 252e5527de..25d2fb79ad 100644--- a/frontend/rust-lib/flowy-grid/src/entities/block_entities.rs+++ b/frontend/rust-lib/flowy-grid/src/entities/block_entities.rs@@ -160,6 +160,16 @@ impl std::convert::From<&RowRevision> for InsertedRowPB {}}+#[derive(Debug, Clone, Default, ProtoBuf)]+pub struct UpdatedRowPB {+ #[pb(index = 1)]+ pub row: RowPB,++ // represents as the cells that were updated in this row.+ #[pb(index = 2)]+ pub field_ids: Vec<String>,+}+#[derive(Debug, Default, Clone, ProtoBuf)]pub struct GridBlockChangesetPB {#[pb(index = 1)]@@ -172,7 +182,7 @@ pub struct GridBlockChangesetPB {pub deleted_rows: Vec<String>,#[pb(index = 4)]- pub updated_rows: Vec<RowPB>,+ pub updated_rows: Vec<UpdatedRowPB>,#[pb(index = 5)]pub visible_rows: Vec<InsertedRowPB>,@@ -197,7 +207,7 @@ impl GridBlockChangesetPB {}}- pub fn update(block_id: &str, updated_rows: Vec<RowPB>) -> Self {+ pub fn update(block_id: &str, updated_rows: Vec<UpdatedRowPB>) -> Self {Self {block_id: block_id.to_owned(),updated_rows,diff --git a/frontend/rust-lib/flowy-grid/src/services/block_manager.rs b/frontend/rust-lib/flowy-grid/src/services/block_manager.rsindex f84cd8af52..5c99b38418 100644--- a/frontend/rust-lib/flowy-grid/src/services/block_manager.rs+++ b/frontend/rust-lib/flowy-grid/src/services/block_manager.rs@@ -1,5 +1,5 @@use crate::dart_notification::{send_dart_notification, GridDartNotification};-use crate::entities::{CellChangesetPB, GridBlockChangesetPB, InsertedRowPB, RowPB};+use crate::entities::{CellChangesetPB, GridBlockChangesetPB, InsertedRowPB, RowPB, UpdatedRowPB};use crate::manager::GridUser;use crate::services::block_editor::{GridBlockRevisionCompress, GridBlockRevisionEditor};use crate::services::persistence::block_index::BlockIndexCache;@@ -111,8 +111,12 @@ impl GridBlockManager {match editor.get_row_rev(&changeset.row_id).await? {None => tracing::error!("Update row failed, can't find the row with id: {}", changeset.row_id),Some((_, row_rev)) => {- let row_pb = make_row_from_row_rev(row_rev);- let block_order_changeset = GridBlockChangesetPB::update(&editor.block_id, vec![row_pb]);+ let changed_field_ids = changeset.cell_by_field_id.keys().cloned().collect::<Vec<String>>();+ let updated_row = UpdatedRowPB {+ row: make_row_from_row_rev(row_rev),+ field_ids: changed_field_ids,+ };+ let block_order_changeset = GridBlockChangesetPB::update(&editor.block_id, vec![updated_row]);let _ = self.notify_did_update_block(&editor.block_id, block_order_changeset).await?;diff --git a/shared-lib/grid-rev-model/src/grid_block.rs b/shared-lib/grid-rev-model/src/grid_block.rsindex e75b2b0f37..476d493330 100644--- a/shared-lib/grid-rev-model/src/grid_block.rs+++ b/shared-lib/grid-rev-model/src/grid_block.rs@@ -46,6 +46,8 @@ pub struct RowChangeset {pub row_id: String,pub height: Option<i32>,pub visibility: Option<bool>,+ // Contains the key/value changes represents as the update of the cells. For example,+ // if there is one cell was changed, then the `cell_by_field_id` will only have one key/value.pub cell_by_field_id: HashMap<FieldId, CellRevision>,}