Not sure if this is a bug or my logic is off. I'm trying to add caching logic to templates to not cache certain pages if they have a block type form
present because of the dynamic CSRF
tokens.
The logic:
{% set doNotCache = entry.mainBody.type('form').all()|length or craft.retour.getHttpStatus != 200 ? true : false %}
If the page returns true
, the page renders properly. If the logic returns false
the entry.mainBody
object is empty (ie. doesn't render the matrix content). If I remove the logic all together the pages render properly.