You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The behavior of {% continue %} inside snippets seems to differ between Shopify Liquid and LiquidJS. In Shopify Liquid, {% continue %} effectively acts as an "early return" from the snippet, preventing any further code in the snippet from rendering. However, in LiquidJS, {% continue %} behaves as it would inside a loop, causing the loop in the parent context to skip to the next iteration.
Steps to Reproduce:
Create a Liquid snippet (example-snippet.liquid):
{% continue %}
<p>This part of the snippet should be skipped</p>
Use the snippet in a layout/section with a parent loop in LiquidJS:
{% for i in (1..3) %}
<p>Loop iteration: {{ i }}</p>
{% render 'example-snippet' %}
<p>This code will be skipped in LiquidJS, but not Shopify Liquid</p>
{% endfor %}
Expected Behaviour (based on Shopify Liquid):
<p>Loop iteration: 1</p>
<p>This code will be skipped in LiquidJS, but not Shopify Liquid</p>
<p>Loop iteration: 2</p>
<p>This code will be skipped in LiquidJS, but not Shopify Liquid</p>
<p>Loop iteration: 3</p>
<p>This code will be skipped in LiquidJS, but not Shopify Liquid</p>
I know that this may seem like a bit of an edge case, but I've seen devs using {% continue %} in Snippets as an early return fairly commonly so should probably be fixed
The text was updated successfully, but these errors were encountered:
Seems include and render behaves differently. include in liquidjs is correct skipping the rest of for body, but continue in snippets called by render should only skip its content.
The behavior of
{% continue %}
inside snippets seems to differ between Shopify Liquid and LiquidJS. In Shopify Liquid, {% continue %} effectively acts as an "early return" from the snippet, preventing any further code in the snippet from rendering. However, in LiquidJS,{% continue %}
behaves as it would inside a loop, causing the loop in the parent context to skip to the next iteration.Steps to Reproduce:
Expected Behaviour (based on Shopify Liquid):
What I actually get with LiquidJS is this:
I know that this may seem like a bit of an edge case, but I've seen devs using
{% continue %}
in Snippets as an early return fairly commonly so should probably be fixedThe text was updated successfully, but these errors were encountered: