Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Identify missing calls to block.shopify_attributes #455

Closed
samdoiron opened this issue Dec 16, 2020 · 3 comments
Closed

Identify missing calls to block.shopify_attributes #455

samdoiron opened this issue Dec 16, 2020 · 3 comments
Labels
area:theme-check enhancement New feature or request good first issue Good for newcomers

Comments

@samdoiron
Copy link

samdoiron commented Dec 16, 2020

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.

@samdoiron
Copy link
Author

samdoiron commented Dec 16, 2020

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.

@macournoyer
Copy link
Contributor

👍 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.

@lukeh-shopify lukeh-shopify transferred this issue from Shopify/theme-check Jul 20, 2024
@charlespwd charlespwd added the good first issue Good for newcomers label Oct 17, 2024
@charlespwd
Copy link
Contributor

Don't know how we can do this reliably. I'm thinking of {% render %}, content_for blocks, {% case block.type %} and so on.

@charlespwd charlespwd closed this as not planned Won't fix, can't repro, duplicate, stale Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:theme-check enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants