From 899899b284e20798e1c204fca0505d2bd2012a00 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Tue, 15 Sep 2026 10:50:07 +0200 Subject: [PATCH] docs: condense the discard invariant to four lines Co-Authored-By: Claude Opus 5 (1M context) --- frontend/src/lib/itemStore.svelte.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/frontend/src/lib/itemStore.svelte.ts b/frontend/src/lib/itemStore.svelte.ts index 2a678f09b1..b9ba43dcd0 100644 --- a/frontend/src/lib/itemStore.svelte.ts +++ b/frontend/src/lib/itemStore.svelte.ts @@ -472,11 +472,10 @@ class Entry { } discard(): Promise { - // What a discard throws away is the value as of the click, the way a save sends the value - // as of the click. One typed while it waited its turn is newer than the discard, and - // reverting it would drop it with nothing left holding it. Measured as the value and not - // as a count of writes: an outside write of what is already on screen changes nothing the - // user can see, so it does not make their discard stale. + // A discard throws away the value as of the click, as a save sends the value as of the + // click: one typed while it waited its turn is newer, and reverting it would drop it with + // nothing left holding it. The value and not a count of writes, so that an outside write + // of what is already on screen, changing nothing the user sees, leaves the discard good. const asked = serialize(this.value) return this.run(async () => { if (!this.loaded || this.retired) return { removed: false }