fix: insert row index

This commit is contained in:
appflowy 2022-04-21 21:24:28 +08:00
parent 8a7c3a9cfc
commit b9135d26a9
4 changed files with 11 additions and 4 deletions

View File

@ -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);
},
);
},

View File

@ -210,7 +210,6 @@ class FlowyOverlayState extends State<FlowyOverlay> {
_overlayList.remove(firstItem);
if (firstItem.delegate != null) {
firstItem.delegate!.didRemove();
if (firstItem.delegate!.asBarrier()) {
return;
}

View File

@ -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?;

View File

@ -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));