autosave issue in checkout - pt1

This commit is contained in:
elvira
2026-09-14 20:13:40 +03:00
parent 97c12efdb1
commit df9374a070
2 changed files with 28 additions and 2 deletions
@@ -101,6 +101,15 @@ export default class extends Controller {
this.saveTimer = setTimeout(() => this.save(), 700)
}
// Called by bbk-payment right before place-order — a debounced save (and
// the shipping-option auto-select that happens as part of it) might still
// be pending when the shopper clicks "place order"; this guarantees the
// server has processed the current form state first.
async flush() {
clearTimeout(this.saveTimer)
await this.save()
}
async save() {
this.saveController?.abort()
this.saveController = new AbortController()