mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: reload card content
This commit is contained in:
@ -317,6 +317,9 @@ class GroupControllerDelegateImpl extends GroupControllerDelegate {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void updateRow(String groupId, RowPB row) {
|
void updateRow(String groupId, RowPB row) {
|
||||||
|
// workaround: fix the board card reload timing issue.
|
||||||
|
Future.delayed(const Duration(milliseconds: 300), () {
|
||||||
controller.updateColumnItem(groupId, BoardColumnItem(row: row));
|
controller.updateColumnItem(groupId, BoardColumnItem(row: row));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ class BoardPluginBuilder implements PluginBuilder {
|
|||||||
|
|
||||||
class BoardPluginConfig implements PluginConfig {
|
class BoardPluginConfig implements PluginConfig {
|
||||||
@override
|
@override
|
||||||
bool get creatable => true;
|
bool get creatable => false;
|
||||||
}
|
}
|
||||||
|
|
||||||
class BoardPlugin extends Plugin {
|
class BoardPlugin extends Plugin {
|
||||||
|
@ -35,19 +35,17 @@ class _BoardSelectOptionCellState extends State<BoardSelectOptionCell> {
|
|||||||
child: BlocBuilder<BoardSelectOptionCellBloc, BoardSelectOptionCellState>(
|
child: BlocBuilder<BoardSelectOptionCellBloc, BoardSelectOptionCellState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
final children = state.selectedOptions
|
final children = state.selectedOptions
|
||||||
.map((option) => SelectOptionTag.fromOption(
|
.map(
|
||||||
|
(option) => SelectOptionTag.fromOption(
|
||||||
context: context,
|
context: context,
|
||||||
option: option,
|
option: option,
|
||||||
))
|
),
|
||||||
|
)
|
||||||
.toList();
|
.toList();
|
||||||
return Align(
|
return Align(
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: AbsorbPointer(
|
child: AbsorbPointer(
|
||||||
child: Wrap(
|
child: Wrap(children: children, spacing: 4, runSpacing: 2),
|
||||||
children: children,
|
|
||||||
spacing: 4,
|
|
||||||
runSpacing: 2,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -42,7 +42,7 @@ class _BoardCardState extends State<BoardCard> {
|
|||||||
_cardBloc = BoardCardBloc(
|
_cardBloc = BoardCardBloc(
|
||||||
gridId: widget.gridId,
|
gridId: widget.gridId,
|
||||||
dataController: widget.dataController,
|
dataController: widget.dataController,
|
||||||
);
|
)..add(const BoardCardEvent.initial());
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,6 +79,12 @@ class _BoardCardState extends State<BoardCard> {
|
|||||||
},
|
},
|
||||||
).toList();
|
).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> dispose() async {
|
||||||
|
_cardBloc.close();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _CardMoreOption extends StatelessWidget with CardAccessory {
|
class _CardMoreOption extends StatelessWidget with CardAccessory {
|
||||||
|
@ -24,7 +24,8 @@ class GridCellDataLoader<T> {
|
|||||||
Future<T?> loadData() {
|
Future<T?> loadData() {
|
||||||
final fut = service.getCell(cellId: cellId);
|
final fut = service.getCell(cellId: cellId);
|
||||||
return fut.then(
|
return fut.then(
|
||||||
(result) => result.fold((GridCellPB cell) {
|
(result) => result.fold(
|
||||||
|
(GridCellPB cell) {
|
||||||
try {
|
try {
|
||||||
return parser.parserData(cell.data);
|
return parser.parserData(cell.data);
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
@ -32,10 +33,12 @@ class GridCellDataLoader<T> {
|
|||||||
Log.error('Stack trace \n $s');
|
Log.error('Stack trace \n $s');
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}, (err) {
|
},
|
||||||
|
(err) {
|
||||||
Log.error(err);
|
Log.error(err);
|
||||||
return null;
|
return null;
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -58,7 +61,8 @@ class DateCellDataParser implements IGridCellDataParser<DateCellDataPB> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class SelectOptionCellDataParser implements IGridCellDataParser<SelectOptionCellDataPB> {
|
class SelectOptionCellDataParser
|
||||||
|
implements IGridCellDataParser<SelectOptionCellDataPB> {
|
||||||
@override
|
@override
|
||||||
SelectOptionCellDataPB? parserData(List<int> data) {
|
SelectOptionCellDataPB? parserData(List<int> data) {
|
||||||
if (data.isEmpty) {
|
if (data.isEmpty) {
|
||||||
|
@ -279,8 +279,9 @@ class IGridCellController<T, D> extends Equatable {
|
|||||||
_loadDataOperation?.cancel();
|
_loadDataOperation?.cancel();
|
||||||
_loadDataOperation = Timer(const Duration(milliseconds: 10), () {
|
_loadDataOperation = Timer(const Duration(milliseconds: 10), () {
|
||||||
_cellDataLoader.loadData().then((data) {
|
_cellDataLoader.loadData().then((data) {
|
||||||
_cellDataNotifier?.value = data;
|
Log.debug('$fieldId CellData: Did Get cell data');
|
||||||
_cellsCache.insert(_cacheKey, GridCell(object: data));
|
_cellsCache.insert(_cacheKey, GridCell(object: data));
|
||||||
|
_cellDataNotifier?.value = data;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -133,8 +133,6 @@ class AFBoardColumnDataController extends ChangeNotifier with EquatableMixin {
|
|||||||
void replaceOrInsertItem(AFColumnItem newItem) {
|
void replaceOrInsertItem(AFColumnItem newItem) {
|
||||||
final index = columnData._items.indexWhere((item) => item.id == newItem.id);
|
final index = columnData._items.indexWhere((item) => item.id == newItem.id);
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
removeAt(index);
|
|
||||||
|
|
||||||
columnData._items.removeAt(index);
|
columnData._items.removeAt(index);
|
||||||
columnData._items.insert(index, newItem);
|
columnData._items.insert(index, newItem);
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
@ -582,7 +582,7 @@ impl GridRevisionEditor {
|
|||||||
|
|
||||||
pub async fn move_group_row(&self, params: MoveGroupRowParams) -> FlowyResult<()> {
|
pub async fn move_group_row(&self, params: MoveGroupRowParams) -> FlowyResult<()> {
|
||||||
let MoveGroupRowParams {
|
let MoveGroupRowParams {
|
||||||
view_id: _,
|
view_id,
|
||||||
from_row_id,
|
from_row_id,
|
||||||
to_group_id,
|
to_group_id,
|
||||||
to_row_id,
|
to_row_id,
|
||||||
@ -597,10 +597,22 @@ impl GridRevisionEditor {
|
|||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
tracing::trace!("Move group row cause row data changed: {:?}", row_changeset);
|
tracing::trace!("Move group row cause row data changed: {:?}", row_changeset);
|
||||||
match self.block_manager.update_row(row_changeset).await {
|
|
||||||
|
let cell_changesets = row_changeset
|
||||||
|
.cell_by_field_id
|
||||||
|
.into_iter()
|
||||||
|
.map(|(field_id, cell_rev)| CellChangesetPB {
|
||||||
|
grid_id: view_id.clone(),
|
||||||
|
row_id: row_changeset.row_id.clone(),
|
||||||
|
field_id,
|
||||||
|
content: cell_rev.data,
|
||||||
|
})
|
||||||
|
.collect::<Vec<CellChangesetPB>>();
|
||||||
|
|
||||||
|
for cell_changeset in cell_changesets {
|
||||||
|
match self.block_manager.update_cell(cell_changeset).await {
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
Err(e) => {
|
Err(e) => tracing::error!("Apply cell changeset error:{:?}", e),
|
||||||
tracing::error!("Apply row changeset error:{:?}", e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user