theme-check
theme-check copied to clipboard
Identify missing calls to block.shopify_attributes
All rendered blocks should to use block.shopify_attributes
like this
{% for block in sections.blocks %}
<div {{ block.shopify_attributes }}></div>
{% endfor %}
This might be tricky to identify. Some cases would be caught by checking the contents of any for loops over section.blocks
, but there are subtleties like the {% render .. for %}
syntax.
This came up as an actually issue in one of our internal themes recently. We use these attributes to live-patch the DOM when settings like a linked image are updated.
👍 Appears to be documented here: https://shopify.dev/docs/themes/liquid/reference/objects/block#block-shopify_attributes.
Maybe we could check that as soon as sections.blocks
is referenced in a template block.shopify_attributes
is always present.