mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: init database row init (#6127)
This commit is contained in:
parent
3324e7837b
commit
8139065113
@ -306,6 +306,8 @@ class MobileRowDetailPageContentState
|
||||
viewId: viewId,
|
||||
rowCache: rowCache,
|
||||
);
|
||||
rowController.initialize();
|
||||
|
||||
cellBuilder = EditableCellBuilder(
|
||||
databaseController: widget.databaseController,
|
||||
);
|
||||
|
@ -35,6 +35,8 @@ class RelatedRowDetailPageBloc
|
||||
on<RelatedRowDetailPageEvent>((event, emit) async {
|
||||
event.when(
|
||||
didInitialize: (databaseController, rowController) {
|
||||
rowController.initialize();
|
||||
|
||||
state.maybeWhen(
|
||||
ready: (_, oldRowController) async {
|
||||
await oldRowController.dispose();
|
||||
@ -93,6 +95,7 @@ class RelatedRowDetailPageBloc
|
||||
viewId: inlineView.id,
|
||||
rowCache: databaseController.rowCache,
|
||||
);
|
||||
|
||||
add(
|
||||
RelatedRowDetailPageEvent.didInitialize(
|
||||
databaseController,
|
||||
|
@ -38,6 +38,9 @@ class RowController {
|
||||
|
||||
List<CellContext> loadCells() => _rowCache.loadCells(rowMeta);
|
||||
|
||||
/// This method must be called to initialize the row controller; otherwise, the row will not sync between devices.
|
||||
/// When creating a row controller, calling [initialize] immediately may not be necessary.
|
||||
/// Only call [initialize] when the row becomes visible. This approach helps reduce unnecessary sync operations.
|
||||
Future<void> initialize() async {
|
||||
await _rowBackendSvc.initRow(rowMeta.id);
|
||||
unawaited(
|
||||
|
@ -397,6 +397,7 @@ class HiddenGroupPopupItemList extends StatelessWidget {
|
||||
viewId: viewId,
|
||||
rowCache: rowCache,
|
||||
);
|
||||
rowController.initialize();
|
||||
|
||||
final databaseController =
|
||||
context.read<BoardBloc>().databaseController;
|
||||
|
@ -29,6 +29,8 @@ class CalendarEventEditorBloc
|
||||
(event, emit) async {
|
||||
await event.when(
|
||||
initial: () {
|
||||
rowController.initialize();
|
||||
|
||||
_startListening();
|
||||
final primaryFieldId = fieldController.fieldInfos
|
||||
.firstWhere((fieldInfo) => fieldInfo.isPrimary)
|
||||
|
@ -20,6 +20,8 @@ class RowDetailBloc extends Bloc<RowDetailEvent, RowDetailState> {
|
||||
_dispatch();
|
||||
_startListening();
|
||||
_init();
|
||||
|
||||
rowController.initialize();
|
||||
}
|
||||
|
||||
final FieldController fieldController;
|
||||
|
@ -32,6 +32,7 @@ class CardBloc extends Bloc<CardEvent, CardState> {
|
||||
rowController.rowMeta,
|
||||
),
|
||||
) {
|
||||
rowController.initialize();
|
||||
_dispatch();
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:appflowy/plugins/database/application/database_controller.dart';
|
||||
import 'package:appflowy/plugins/database/application/row/row_controller.dart';
|
||||
import 'package:appflowy/plugins/database/application/row/row_service.dart';
|
||||
@ -87,6 +89,8 @@ class DatabaseDocumentTitleBloc
|
||||
viewId: view.id,
|
||||
rowCache: databaseController.rowCache,
|
||||
);
|
||||
unawaited(rowController.initialize());
|
||||
|
||||
final primaryFieldId =
|
||||
await FieldBackendService.getPrimaryField(viewId: view.id).fold(
|
||||
(primaryField) => primaryField.id,
|
||||
|
Loading…
Reference in New Issue
Block a user