Skip to content

Stop rendering after a Liquid nesting limit error - #2136

Open
efegokdemir wants to merge 1 commit into
Shopify:mainfrom
efegokdemir:efe/liquid-stack-level-error-1435
Open

efegokdemir wants to merge 1 commit into
Shopify:mainfrom
efegokdemir:efe/liquid-stack-level-error-1435

Conversation

@efegokdemir

Copy link
Copy Markdown

Recursive includes can branch exponentially after the nesting limit because lax rendering converts StackLevelError to inline text and continues through sibling nodes. This change records the template and line context, then raises the error so rendering stops at the first limit breach. A low-depth regression test covers the branching include case.

bundle exec rake and bundle exec rake spec pass on Ruby 4.0.2. Fixes #1435.

Preserve template and line metadata while stopping a render on StackLevelError. This avoids continuing through exponentially branching recursive partials after the nesting guard is reached.

Fixes Shopify#1435

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rendering continues after Liquid::StackLevelError which can result in a lot of similar errors with recursion

1 participant