Currently, the checkout flow form does not respect cacheable metadata of the order or its configuration entity. It must. This way any changes outside of the form cause the form's cache to adjust. EntityForms do this via

    // Ensure that edit forms have the correct cacheability metadata so they can
    // be cached.
    if (!$this->entity->isNew()) {
      \Drupal::service('renderer')->addCacheableDependency($form, $this->entity);
    }

Comments

mglaman created an issue. See original summary.

mglaman’s picture

Status: Active » Needs review
StatusFileSize
new1.23 KB

Here is a patch which adds the order as cacheable dependency. This means the checkout flow cache will basically be busted if the order refreshes. Such as someone decided to sit on the checkout for a few minutes or a few hours.

mglaman’s picture

Status: Needs review » Needs work

PR https://github.com/drupalcommerce/commerce/pull/777

Needed patch to manually test. But this really needs a proper test.

mglaman’s picture

Status: Needs work » Needs review
StatusFileSize
new3.81 KB

Adds test. Interestingly enough the cache tags were part of the page cache from elsewhere. However not in the form. So without explicitly adding them to the checkout flow's form render array, it did not cause a MISS in the dynamic cache.

Build with fix commented out and test: https://travis-ci.org/drupalcommerce/commerce/builds/267327175?utm_sourc...

Build with fix and test: https://travis-ci.org/drupalcommerce/commerce/builds/267327689?utm_sourc...

mglaman’s picture

StatusFileSize
new6.4 KB

Updated patch which asserts modifying the config entity will also bust cache.

  • bojanz committed 7c2decc on 8.x-2.x authored by mglaman
    Issue #2903935 by mglaman: Checkout flows should have the order and...

bojanz credited bojanz.

bojanz’s picture

Status: Needs review » Fixed

There's no way this is the last bug we have here. But at least we've made a start.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.