Skip to content

Guard async element fetches against out-of-order responses#1314

Draft
bpapillon wants to merge 2 commits into
mainfrom
bpapillon/checkout-async-race-guards
Draft

Guard async element fetches against out-of-order responses#1314
bpapillon wants to merge 2 commits into
mainfrom
bpapillon/checkout-async-race-guards

Conversation

@bpapillon

@bpapillon bpapillon commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Stacked on #1313. Applies the same "last request wins" approach to UpcomingBill, Invoices, PaymentMethodDetails

bpapillon added 2 commits June 4, 2026 15:32
Discard stale preview responses via a request-id guard, and debounce
previews triggered by rapid-fire inputs (quantity, credit bundle count,
auto top-up). Typing a multi-digit quantity fired one preview per
keystroke; whichever response resolved last won, so the dialog could
show charges for a quantity the user was no longer requesting (e.g.
$0 due after typing "11" when the "1" preview resolved last).
Extract the stale-response guard from CheckoutDialog into a
useLatestRequestGuard hook and apply it to the other components that
set state from un-guarded async fetches: UpcomingBill (invoice +
balances), Invoices, and PaymentMethodDetails (setup intent).
@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown

🚀 Components Preview Deployed!

📍 Preview URL: https://schematic-next-example-4u6mzgyab-schematichq.vercel.app
🔄 Components Version: Built from commit 3cc7e12
📦 Demo App: schematichq/schematic-next-example

Base automatically changed from bpapillon/schy-404-tiered-checkout-shows-0-when-crossing-tier-by-one to main June 5, 2026 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant