Settle a failed Discover decision on the deck's newest read
CI / ci (push) Successful in 2m56s
CI / ci (pull_request) Successful in 2m38s

A failed decision still waits for the deck read it makes itself, but no
longer carries that read's answer on its error. Whether its Side quest is
still pending is now asked of the deck query's newest successful read
(stillPending), both when the decision settles and when the page offers
Retry. A read that lands later and has the Side quest decided keeps it off
the deck and withdraws the Retry; a deck whose latest read failed offers no
Retry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-07 03:45:51 -04:00
co-authored by Claude Opus 5.5
parent 8b18399710
commit 701021d327
3 changed files with 84 additions and 35 deletions
+6 -6
View File
@@ -12,6 +12,7 @@ import {
BATCH_JOB_KIND,
DECK_KEY,
parseBatchResult,
stillPending,
useDeck,
useDecide,
useQuestLog,
@@ -90,8 +91,8 @@ function QuestLogPill({ dinners, ref }: { dinners: { id: string; name: string }[
// at a time from the top card. A decision from the buttons, the ← / → keys
// or a swipe of the top card throws it out (motion.ts) and sends the
// decision once it is gone, taking the card off the deck at once (see
// useDecide); Retry sends a failed one again while the deck it read after
// failing still had its Side quest pending. Input is locked from the press
// useDecide); Retry sends a failed one again while the deck's newest read
// still has its Side quest pending. Input is locked from the press
// until the decision settles, which is once the deck and the Quest log have
// been read again after it, so no decision starts under those reads. The lock is a
// ref, set before anything starts, so a second press before the next render
@@ -322,10 +323,9 @@ export function DiscoverPage() {
.then(() => (after ? queryClient.invalidateQueries({ queryKey: DECK_KEY }, { cancelRefetch: false }) : undefined))
}, [queryClient, job.status, stored])
// A failed decision can be retried only while the deck it read after
// failing still has its Side quest pending: anything else decided it
// already.
const pending = decision.isError ? decision.error.pending : undefined
// A failed decision can be retried only while the deck's newest read
// still has its Side quest pending: anything else decided it already.
const pending = decision.isError ? stillPending(deck, decision.variables.quest.id) : undefined
const retryable = pending !== undefined && pending !== null
let body