Field sync controller - #1429
Draft
pbennett1-godaddy wants to merge 4 commits into
Draft
Conversation
…ld-sync-controller # Conflicts: # packages/react/src/components/checkout/payment/utils/use-confirm-checkout.ts
…ld-sync-controller
🦋 Changeset detectedLatest commit: bc32f15 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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
This PR fixes checkout race conditions where a customer could click confirm/pay before debounced draft-order field syncs had completed. In those cases, checkout confirmation could run against a stale
draft order and miss recent form edits such as contact info, names, notes, shipping/billing addresses, phone values, or fulfillment-related order updates.
The main change centralizes draft-order field syncing behind a registration-based sync controller. Before confirmation, checkout now drains queued work, waits for critical checkout mutations/fetches,
rebuilds a final patch from the latest form values, sends it when needed, refetches the updated draft order, and only then confirms checkout.
This PR also tightens validation behavior for
checkoutFormSchemaso custom schema rules are enforced for fields the current checkout flow actually collects, without blocking checkout onhidden/uncollectable fields. For example, a custom-required
shippingAddressLine2does not block a pickup checkout where shipping fields are hidden, and a custom-required phone field does not blockcheckout when phone collection is disabled.
Changeset
Test Plan
Validated with targeted unit/integration tests and package checks:
Covered scenarios include: