Shopify / Shopify/liquid

Since 4.0.0 'nil' values are ignored inside cycle tag

Open
#922 2 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

The code below has different renders using liquid versions <=3.0.6 and 4.0.0

{% for i in (1..4) %}
  {% cycle '<section>', nil %}
    <div>
      <p>{{ i }}</p>
    </div>
  {% cycle nil, '</section>' %}
{% endfor %}

3.0.6 Two 'section' blocks:

  <section>
    <div>
      <p>1</p>
    </div>

    <div>
      <p>2</p>
    </div>
  </section>

  <section>
    <div>
      <p>3</p>
    </div>

    <div>
      <p>4</p>
    </div>
  </section>

4.0.0 Four 'section' blocks:

  <section>
    <div>
      <p>1</p>
    </div>
  </section>

  <section>
    <div>
      <p>2</p>
    </div>
  </section>

  <section>
    <div>
      <p>3</p>
    </div>
  </section>

  <section>
    <div>
      <p>4</p>
    </div>
  </section>

The upgrade to 4.0.0 is breaking the appearance of a website I'm supporting. I've not found any documentation references for such 'cycle' usage, so I'm not sure if it is some hack worked in previous verions or it's a bug of 4.0.0.

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 supplied cycle-tag example under Liquid 3.0.6 and 4.0.0, then trace the cycle tag entry point and its handling of nil values. Done means the intended grouping is established and covered by a regression test, with the example rendering consistently under the supported behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.