mirror of
https://github.com/kodjodevf/mangayomi.git
synced 2026-04-20 19:12:04 +00:00
bulk write instead of one-by-one (bookmark)
reduces IO-operations.
This commit is contained in:
parent
88a5474f96
commit
fc3cf226f7
1 changed files with 9 additions and 9 deletions
|
|
@ -858,16 +858,16 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
|
|||
final chapters = ref.watch(
|
||||
chaptersListStateProvider,
|
||||
);
|
||||
final List<Chapter> updatedChapters = [];
|
||||
final now = DateTime.now().millisecondsSinceEpoch;
|
||||
for (var chapter in chapters) {
|
||||
chapter.isBookmarked = !chapter.isBookmarked!;
|
||||
chapter.updatedAt = now;
|
||||
chapter.manga.value = widget.manga;
|
||||
updatedChapters.add(chapter);
|
||||
}
|
||||
isar.writeTxnSync(() {
|
||||
for (var chapter in chapters) {
|
||||
chapter.isBookmarked = !chapter.isBookmarked!;
|
||||
chapter.updatedAt =
|
||||
DateTime.now().millisecondsSinceEpoch;
|
||||
isar.chapters.putSync(
|
||||
chapter..manga.value = widget.manga,
|
||||
);
|
||||
chapter.manga.saveSync();
|
||||
}
|
||||
isar.chapters.putAllSync(updatedChapters);
|
||||
});
|
||||
ref
|
||||
.read(isLongPressedStateProvider.notifier)
|
||||
|
|
|
|||
Loading…
Reference in a new issue