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

Apply a recursion counter to the recent build_display filter recursion limiter #7451

Closed
deanmarcussen opened this issue Oct 30, 2020 · 3 comments · Fixed by #7500
Closed

Comments

@deanmarcussen
Copy link
Member

Feature added here #7357

Need to add counter to it to allow shapes to be built more than once (think bag items, in different display modes).

But still limit the amount of times this can happen to prevent stackoverflows when accidentally called recursively from within the same content template.

@deanmarcussen deanmarcussen changed the title Apply a recursion counter to the recent build_display filter Apply a recursion counter to the recent build_display filter recursion limiter Oct 30, 2020
@jeffolmstead
Copy link
Contributor

As commented on Gitter, my breaking example is:

{% for blogPost in recentBlogPosts %}
  {{ blogPost | shape_build_display: "Featured" | shape_render }}
  {{ blogPost | shape_build_display: "Thumbnail" | shape_render }} 
{% endfor %}

Thanks for tackling this.

@sebastienros
Copy link
Member

how is Jeff's bug related to full text? I assumed the recursion limit was only applied to full text generation which is recursive. Unless it has also been implemented to shape display, in which case the key should take the display type into account. But I assume a counter works too, as long as it's a setting.

@deanmarcussen
Copy link
Member Author

It slipped in because I tested the other content filters at the same time, and discovered the issue with the build_display filter.

I used a counter rather than a display type, as there's been times (in Razor) I've built the display type twice, and then mutated the shapes to display differently (breadcrumbs, tiles, and list items).

So I set it at 20 - which feels really high, but this was about preventing accidental mistakes bringing the site down. It quickly becomes obvious that a mistake in the template has been made.

Could be an Option so it's configurable.

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 a pull request may close this issue.

3 participants