mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-01-22 16:56:19 +01:00
Fix initial sync not starting on first run
This commit is contained in:
parent
9e3ec0bfc3
commit
bc3c480223
2 changed files with 12 additions and 11 deletions
|
@ -551,9 +551,7 @@ class FilesController {
|
|||
excludeRelativeRoots: [remote_storage_util.remoteStorageDirRelativePath],
|
||||
mimes: file_util.supportedFormatMimes,
|
||||
);
|
||||
_summaryStreamController.addWithValue((value) => value.copyWith(
|
||||
summary: results,
|
||||
));
|
||||
_summaryStreamController.add(FilesSummaryStreamEvent(summary: results));
|
||||
}
|
||||
|
||||
_MockResult _mockRemove({
|
||||
|
@ -645,11 +643,7 @@ class FilesController {
|
|||
);
|
||||
|
||||
var _isSummaryStreamInited = false;
|
||||
final _summaryStreamController = BehaviorSubject.seeded(
|
||||
const FilesSummaryStreamEvent(
|
||||
summary: DbFilesSummary(items: {}),
|
||||
),
|
||||
);
|
||||
final _summaryStreamController = BehaviorSubject<FilesSummaryStreamEvent>();
|
||||
|
||||
final _timelineStreamController = BehaviorSubject.seeded(
|
||||
const TimelineStreamEvent(data: {}, isDummy: true),
|
||||
|
|
|
@ -130,9 +130,16 @@ class _Bloc extends Bloc<_Event, _State> with BlocLogger {
|
|||
await Future.wait([
|
||||
emit.forEach<FilesSummaryStreamEvent>(
|
||||
filesController.summaryStream,
|
||||
onData: (data) => state.copyWith(
|
||||
onData: (data) {
|
||||
if (data.summary.items.isEmpty && _isInitialLoad) {
|
||||
// no data, initial sync
|
||||
_isInitialLoad = false;
|
||||
_syncRemote();
|
||||
}
|
||||
return state.copyWith(
|
||||
filesSummary: data.summary,
|
||||
),
|
||||
);
|
||||
},
|
||||
onError: (e, stackTrace) {
|
||||
_log.severe("[_onLoad] Uncaught exception", e, stackTrace);
|
||||
return state.copyWith(
|
||||
|
|
Loading…
Reference in a new issue