fix: address coordinate review findings

Issue: #224
User-Visible: no
This commit is contained in:
Sergey Matyunin
2026-08-22 15:32:55 +03:00
parent 51fde854e3
commit 4dbdb446f8
10 changed files with 107 additions and 32 deletions
+11
View File
@@ -0,0 +1,11 @@
/**
* Append one write to a promise chain without letting an earlier rejection
* poison later edits. The callback is deliberately invoked only when its turn
* starts, so it can read the latest local state at that moment.
*/
export function enqueueSerializedWrite(
previous: Promise<void>,
write: () => Promise<void>,
): Promise<void> {
return previous.catch(() => undefined).then(write);
}