fix: preserve photo drafts while reopening Today progress
This commit is contained in:
1 parent
9a4a1711fe
commit
4f07402936
2 files changed
+48
-12
No files matched your search
@@ -35,12 +35,11 @@
|
||||
await current.pending;
|
||||
const attachments = await store.load(target);
|
||||
if (generation !== current.generation) return false;
|
||||
current.controller.clear();
|
||||
if (attachments?.length) {
|
||||
current.restoring = true;
|
||||
try { current.controller.restore(attachments); }
|
||||
finally { current.restoring = false; }
|
||||
}
|
||||
current.restoring = true;
|
||||
try {
|
||||
current.controller.clear();
|
||||
if (attachments?.length) current.controller.restore(attachments);
|
||||
} finally { current.restoring = false; }
|
||||
return Boolean(attachments?.length);
|
||||
}
|
||||
|
||||
@@ -51,9 +50,13 @@
|
||||
try { await checkpoint(kind); }
|
||||
catch (_error) { return false; }
|
||||
if (generation === current.generation) {
|
||||
current.controller.clear();
|
||||
current.target = null;
|
||||
current.generation += 1;
|
||||
current.restoring = true;
|
||||
try { current.controller.clear(); }
|
||||
finally {
|
||||
current.restoring = false;
|
||||
current.target = null;
|
||||
current.generation += 1;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -64,9 +67,13 @@
|
||||
const target = { ...current.target };
|
||||
await current.pending;
|
||||
await store.remove(target);
|
||||
current.controller.clear();
|
||||
current.target = null;
|
||||
current.generation += 1;
|
||||
current.restoring = true;
|
||||
try { current.controller.clear(); }
|
||||
finally {
|
||||
current.restoring = false;
|
||||
current.target = null;
|
||||
current.generation += 1;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user