perf(learn): Delete now leaves Recently deleted at once
Deleting a studyset for good blanks and deletes every card, note, path and PDF of its subtree before the studyset's row goes, which took about 3 s while the studyset stayed in Recently deleted. Now the repository's Recently deleted leaves it out at once (StudysetRepository.leaving and stay, applied to the value last read without reading again), the deletion runs in the background, still one at a time in StudysetDeletions' queue, and where it fails the studyset shows there again, read anew with what is left of it, and a snack bar says so. Whats-New: Delete now in Recently deleted takes a studyset away at once. Whats-New-De: „Jetzt löschen“ unter „Zuletzt gelöscht“ entfernt ein Lernset sofort. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
c954e844f7
commit
920e1c6c13
1 changed files with 190 additions and 7 deletions
|
|
@ -32,6 +32,12 @@ class FakeCardGateway() implements CardGateway {
|
|||
/// When set, storing a card or a revision fails with it.
|
||||
Exception? failWrites;
|
||||
|
||||
/// When set, deleting a card fails with it, before anything is blanked.
|
||||
Exception? failDeletes;
|
||||
|
||||
/// When set, deleting a card waits until it completes.
|
||||
Completer<void>? holdDeletes;
|
||||
|
||||
/// The payload each revision holds now, by revision id.
|
||||
Map<String, ByteData> get payloads => {
|
||||
for (final revision in _revisions.values) revision.id: revision.payload,
|
||||
|
|
@ -159,6 +165,10 @@ class FakeCardGateway() implements CardGateway {
|
|||
|
||||
@override
|
||||
Future<void> blankRevisions(String cardId) async {
|
||||
await holdDeletes?.future;
|
||||
if (failDeletes case final error?) {
|
||||
throw error;
|
||||
}
|
||||
deletions.add('blank $cardId');
|
||||
for (final revision in [..._revisions.values]) {
|
||||
if (revision.cardId == cardId) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue