Browse Source

harbour: Improve previous data access in API calls

pull/19/head
Kate Doeen 2 years ago
parent
commit
9f56e01c47
No known key found for this signature in database
GPG Key ID: 9F81F962D88883F8
  1. 2
      packages/harbour/lib/src/apps/news/blocs/articles.dart
  2. 4
      packages/harbour/lib/src/apps/news/blocs/news.dart
  3. 2
      packages/harbour/lib/src/apps/notes/blocs/notes.dart

2
packages/harbour/lib/src/apps/news/blocs/articles.dart

@ -157,7 +157,7 @@ class NewsArticlesBloc extends $NewsArticlesBloc {
getRead: getRead, getRead: getRead,
))!, ))!,
(final response) => response.items, (final response) => response.items,
previousData: _articlesSubject.hasValue ? _articlesSubject.value.data : null, previousData: _articlesSubject.valueOrNull?.data,
) )
.listen(_articlesSubject.add); .listen(_articlesSubject.add);
} }

4
packages/harbour/lib/src/apps/news/blocs/news.dart

@ -187,7 +187,7 @@ class NewsBloc extends $NewsBloc {
'news-folders', 'news-folders',
() async => (await client.news.listFolders())!, () async => (await client.news.listFolders())!,
(final response) => response.folders, (final response) => response.folders,
previousData: _foldersSubject.hasValue ? _foldersSubject.value.data : null, previousData: _foldersSubject.valueOrNull?.data,
) )
.listen(_foldersSubject.add); .listen(_foldersSubject.add);
} }
@ -203,7 +203,7 @@ class NewsBloc extends $NewsBloc {
_newestItemId = response.newestItemId; _newestItemId = response.newestItemId;
return response.feeds; return response.feeds;
}, },
previousData: _feedsSubject.hasValue ? _feedsSubject.value.data : null, previousData: _feedsSubject.valueOrNull?.data,
).listen(_feedsSubject.add); ).listen(_feedsSubject.add);
} }

2
packages/harbour/lib/src/apps/notes/blocs/notes.dart

@ -77,7 +77,7 @@ class NotesBloc extends $NotesBloc {
'notes-notes', 'notes-notes',
() async => (await client.notes.getNotes())!, () async => (await client.notes.getNotes())!,
(final response) => response, (final response) => response,
previousData: _notesSubject.hasValue ? _notesSubject.value.data : null, previousData: _notesSubject.valueOrNull?.data,
) )
.listen(_notesSubject.add); .listen(_notesSubject.add);
} }

Loading…
Cancel
Save