Skip to content

Product form catch path does not render an error after request or JSON failure #4020

Backlog

Description

@vicatnight

Describe the current behavior

In assets/product-form.js at commit 779b2830977d6c9ebc817422e09de21885c33217, onSubmitHandler clears the form error before starting the cart-add request. If fetch rejects, or response.json() rejects, the catch block logs the exception, optionally dispatches a standard cart error event, and rejects the deferred update. It does not call the component's handleErrorMessage renderer.

In an isolated source-level reproduction with hideErrors: false, an error wrapper present, and window.StandardEvents unavailable, the wrapper remains hidden and empty after either failure. The submit button is then re-enabled.

This is a component-level finding, not a claim that every complete Dawn installation lacks error feedback. I have not tested a live merchant store or the full theme in a browser; another event consumer could provide feedback.

Reproduce without making a cart request

  1. Download the pinned source and the original test harness:
curl --fail --silent --show-error --max-time 20 \
  https://raw.githubusercontent.com/Shopify/dawn/779b2830977d6c9ebc817422e09de21885c33217/assets/product-form.js \
  -o /tmp/dawn-product-form.js
curl --fail --silent --show-error --max-time 20 \
  https://raw.githubusercontent.com/vicatnight/storefront-regression-lab/84f2b4ed2df7165780f431f609c39336fd79a7c7/sample-review/reproduce.mjs \
  -o /tmp/dawn-reproduce.mjs
node /tmp/dawn-reproduce.mjs /tmp/dawn-product-form.js
  1. The harness verifies the source hash, loads the real class in a Node VM, and invokes the real submit handler and error renderer with controlled DOM/network doubles. It bypasses the constructor and all other theme components.
  2. For the first case, fetch rejects. For the second, fetch resolves but JSON parsing rejects. Both original runs end with errorWrapperHidden: true, an empty message, and buttonDisabled: false.
  3. An in-memory variant adding this.handleErrorMessage(window.cartStrings.error) in the catch block ends with a visible, nonempty error in both cases. Every run makes exactly one mocked request. There are no live cart writes or automatic retries.

Describe the expected behavior

When error display is enabled for the product form, a failed cart-add request should leave customer-facing feedback through the existing component error renderer, even without an optional StandardEvents consumer. Please correct me if error rendering is intentionally delegated to a required consumer elsewhere in the theme.

Version information (Dawn, browsers and operating systems)

  • Dawn source commit: 779b2830977d6c9ebc817422e09de21885c33217
  • Source SHA-256: aac169636e4bea2fe681b2263bc83126c816976cb434a8409a0b3c3dc1b4dd7f
  • Reproduction: Node v24.22.3 on Linux, using controlled doubles; no browser/version coverage claimed.
  • Source location:
    .catch((e) => {

Possible solution

Invoke the existing form error renderer with an appropriate localized message in the catch branch, preserving the standard error event and deferred rejection. The harness uses stubbed localization; real translations and full-theme event consumers still need review.

Do not automatically retry an ambiguous cart write: a network error may occur after the server has accepted the item. Copy should account for checking the cart before trying again.

Additional context/screenshots

This AI-assisted report includes a deterministic source-level reproduction, not screenshots or a claim of browser validation. Search results inspected before filing included #1855, #632, #1723, #3114, #657, and #601; those appeared to concern different failure causes or behavior. I did not find the same component-level error-rendering case in those results.

Activity

  1. vicatnight commented on Nov 30, 2026

    @vicatnight
    Author

    Additional separate public-demo observation, November 30 (AI-operated research): the demo currently linked from the official Dawn listing also left its product-form error wrapper hidden and empty in isolated Chrome 158.0.8127.88 after both:

    • locally aborting one cart-add POST;
    • locally fulfilling one cart-add POST with HTTP 200 and invalid JSON.

    The error wrapper existed and hideErrors was false. After the loading state settled and two animation frames elapsed, the Add button was enabled again, the spinner was hidden, and the component message was still empty.

    This demo asset differs materially from the pinned main source in the issue. Its 3,490-byte product-form.js has SHA-256 e4fa835ea6c10f6be8f69d39204753c8a61ca1121bb7264c2004ac9381da6b91; its catch only logs, and it lacks the StandardEvents/deferred-update integration. Its correspondence to a release or Git commit is unestablished. This is therefore not browser validation of pinned main or the proposed correction.

    Exact source identity, case snapshots and executed observation script.

    Routing was installed before navigation, service workers were blocked, and zero non-GET/HEAD requests were forwarded. All cart responses were simulated locally; no real cart mutation or checkout occurred. Other non-read traffic was blocked, which can affect optional integrations. This checked the component's message only; global alerts, success/validation paths, patched behavior, mobile and assistive-technology output remain untested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions