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: insert row index

appflowyb9135d26a9bb
diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/grid_page.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/grid_page.dart
index 0fc69efc42..6e01d56b66 100755
--- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/grid_page.dart
+++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/grid_page.dart
@@ -213,7 +213,8 @@ class _GridRowsState extends State<_GridRows> {
key: _key,
initialItemCount: context.read<GridBloc>().state.rows.length,
itemBuilder: (BuildContext context, int index, Animation<double> animation) {
- return _renderRow(context, state.rows[index], animation);
+ final rowData = context.read<GridBloc>().state.rows[index];
+ return _renderRow(context, rowData, animation);
},
);
},
diff --git a/frontend/app_flowy/packages/flowy_infra_ui/lib/src/flowy_overlay/flowy_overlay.dart b/frontend/app_flowy/packages/flowy_infra_ui/lib/src/flowy_overlay/flowy_overlay.dart
index bddbbd90b8..91412df599 100644
--- a/frontend/app_flowy/packages/flowy_infra_ui/lib/src/flowy_overlay/flowy_overlay.dart
+++ b/frontend/app_flowy/packages/flowy_infra_ui/lib/src/flowy_overlay/flowy_overlay.dart
@@ -210,7 +210,6 @@ class FlowyOverlayState extends State<FlowyOverlay> {
_overlayList.remove(firstItem);
if (firstItem.delegate != null) {
firstItem.delegate!.didRemove();
-
if (firstItem.delegate!.asBarrier()) {
return;
}
diff --git a/frontend/rust-lib/flowy-grid/src/services/block_meta_editor.rs b/frontend/rust-lib/flowy-grid/src/services/block_meta_editor.rs
index 977ccccb3d..b4d8bccbe5 100644
--- a/frontend/rust-lib/flowy-grid/src/services/block_meta_editor.rs
+++ b/frontend/rust-lib/flowy-grid/src/services/block_meta_editor.rs
@@ -61,6 +61,10 @@ impl ClientGridBlockMetaEditor {
let change = block_pad.add_row_meta(row, start_row_id)?;
row_count = block_pad.number_of_rows();
+
+ if row_index.is_none() {
+ row_index = Some(row_count - 1);
+ }
Ok(change)
})
.await?;
diff --git a/frontend/rust-lib/flowy-grid/src/services/block_meta_manager.rs b/frontend/rust-lib/flowy-grid/src/services/block_meta_manager.rs
index 58c623adc6..5e0927795b 100644
--- a/frontend/rust-lib/flowy-grid/src/services/block_meta_manager.rs
+++ b/frontend/rust-lib/flowy-grid/src/services/block_meta_manager.rs
@@ -92,8 +92,11 @@ impl GridBlockMetaEditorManager {
let mut row_count = 0;
for row in row_metas {
let _ = self.persistence.insert_or_update(&row.block_id, &row.id)?;
- inserted_row_orders.push(IndexRowOrder::from(&row));
- row_count = editor.create_row(row, None).await?.0;
+ let mut row_order = IndexRowOrder::from(&row);
+ let (count, index) = editor.create_row(row, None).await?;
+ row_count = count;
+ row_order.index = index;
+ inserted_row_orders.push(row_order);
}
changesets.push(GridBlockMetaChangeset::from_row_count(&block_id, row_count));