Shopify / Shopify/liquid

App Block Missing Data On Theme Previews When Proceeded by a Hidden Section Containing an @app Block

Open
#1,797 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
11.9k
Forks
1.5k
Avg merge
17h 55m
Merged PRs (30d)
3

Description

Describe the current behavior

When a theme section containing our app block/theme extension is placed directly after a hidden section which contains an app block, liquid data is not correctly passed to our app block.

Describe the expected behavior
Block liquid data should be available to the app block regardless of block/section order and customiser "visibility" status

Version information (Dawn, browsers and operating systems)
Dawn Version: 13.0.1
(as well as all themes)

Chrome Version 108.0.5359.124
macOS Version 13.1

Possible solution
This appears to be a bug in the Shopify liquid parser and specifically impacts offline/preview themes so possible solutions are unclear

Additional context/screenshots

Partner created issue in Dawn theme repository: https://github.com/Shopify/dawn/issues/3413

INCORRECT BEHAVIOR
https://screenshot.click/23-18-83764-334.png

CORRECT BEHAVIOR
https://screenshot.click/23-18-53103-15399.png

From the partner: https://partners.shopify.com/internal/organizations/183065

QUOTE:

_I'm reaching out as we've discovered a bug with Shopify's parsing of theme sections as result of an issue brought to our attention by a number of merchants using our app.

To give you a brief overview of the bug:

  • What we're noticing is that when our app block is proceeded by a HIDDEN section which contains any other app block, liquid data is not correctly passed to our app block / widget.
  • We're able to reliable reproduce this across stores and themes
  • The specific data in this case is the ID of a product in a product page template, derived from {{ block.settings.product.id }}
  • We've also noticed through testing that this issue may potentially manifest itself slightly differently, depending on the region a user is visiting the merchant's store from. While we're not 100% certain of this, we believe based on our testing that this bug may for example only impact offline theme previews for AU visitors whereas for US visitors, the impact can be seen on live themes.

The specific issue this bug causes in our case (which is what merchants are reporting to us) is that due to the missing product ID value, our review app widget falls back to displaying all reviews as opposed to only those belonging to the specific product being viewed by the user.

I've reported this issue on the Dawn theme GitHub repository here: https://github.com/Shopify/dawn/issues/3413 Although admittedly, since this bug impacts all themes, that repository likely isn't the ideal place for the bug report.

It would be great to have this bug investigated and ideally resolved. Please let me know if any further information is needed._

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the behavior described for a theme section following a hidden section containing an @app block, using the linked Dawn issue and the provided screenshots as references. Trace how Liquid parses block.settings.product.id in offline and preview themes; done means block liquid data remains available regardless of section order or visibility status.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.