Fix glitches reported by auction customers#8
Open
curiousdaniel wants to merge 1 commit into
Open
Conversation
Submit-lock guards prevent double-submits across bidder add, sale form, and payment modal. Bidder adds immediately flush a single-event cloud snapshot so background pulls can't wipe local-only bidders. Sticky consignor: stop clearing consignor between lots in clerking; add an opt-out preference (default on). Lot autofill still overrides when a different consignor is loaded. Invoices stop scroll-jumping: list sorts by invoice number instead of generatedAt; recalc skips the row update and generatedAt bump when nothing actually changed; allocate + recalc now run in one Dexie transaction so totals update once instead of flickering. Paid invoices stop reverting to unpaid: PaymentModal bumps generatedAt and uses enqueueInvoicePatch instead of full invoice.put. applyRemoteOp and snapshotMerge preserve local paid status when an incoming row says unpaid. Auto-allocate sale to the bidder's open invoice on every successful clerk write, so items can no longer go missing from invoices. Inside-tx duplicate-sale guard catches multi-device races. One-shot repair pass detaches legacy duplicate sale rows attached to the same lot on one invoice (gated by a localStorage flag). InvoiceDetail does display-side dedupe by lotId as a belt-and-suspenders. Tests cover paid-status protection, no-op recalc, sticky consignor pref, and the duplicate-line repair pass. All 162 tests pass; tsc and next lint clean. Co-authored-by: Cursor <cursoragent@cursor.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Eight reliability bugs reported by customers during live auctions, traced to concrete root causes and fixed end-to-end. Bugs only — feature requests deferred to a later plan.
submittingRefguard on the sale form (coversonSubmitand Shift+Enter), button disabled in flight, and a 1.5s(event, lot, suffix, paddle, lineHammer)signature guard. Inside-txsalesOnLot.count()re-checks catch multi-device races.linkedConsignorIdno longer cleared after each sale; lot autofill still overrides; new "Keep consignor between lots" pref (default on) inclerkFormPrefs.invoiceNumber(stable) instead ofgeneratedAt;recalculateAndPersistInvoiceis a true no-op when totals match;upsertInvoiceForBidderonly bumpsgeneratedAtwhen sales were actually allocated.db.transaction("rw", [events, invoices, sales]);useLiveQueryfires once.PaymentModalbumpsgeneratedAtand usesenqueueInvoicePatch(not fullinvoice.put);applyRemoteOpandsnapshotMergepreserve local paid status, paymentMethod, paymentDate, and generatedAt when an incoming row is unpaid.confirmingstate onPaymentModal; row-reorder and revert fixes above remove the other contributors.upsertInvoiceForBidderafter every successful sale (kills "missing items"); inside-tx duplicate-sale guard; one-shotrepairDuplicateInvoiceLinespass detaches legacy duplicate sale rows attached to the same lot on one invoice (gated byclerkbid:duplicateInvoiceLinesRepaired:v1);InvoiceDetaildoes display-side dedupe bylotIdas belt-and-suspenders.Files
app/(protected)/invoices/page.tsxcomponents/bidders/BidderForm.tsxcomponents/clerking/SaleForm.tsxcomponents/invoices/InvoiceDetail.tsxcomponents/invoices/PaymentModal.tsxcomponents/providers/UserDbProvider.tsxlib/clerkFormPrefs.ts(+ test)lib/db/repairDuplicateInvoiceLines.ts(new, + test)lib/services/invoiceLogic.ts(+ test)lib/services/snapshotMerge.ts(+ test)lib/sync/ops/applyRemoteOp.tsTest plan
npx vitest run— 162 tests pass (added: paid-status protection in snapshot merge, no-op recalc, sticky-consignor pref, duplicate-invoice-line repair).npx tsc --noEmitclean.npx next lint— only two pre-existing warnings in untouched code.Made with Cursor