Is there an undocumented shortcoming of Live Preview? Seems to only work where the entry variable is concerned.
I'm using a Structure section to create pages with "Chapters". The section (let's call it Areas) has a Max Level of 2. The idea is that level 1 entries load a template that calls the content from all of that entry's children.
For instance, Areas looks like this in the CP:
Learning
-- Our Approach
-- Design Patterns
-- etc.
The front-end works just fine. /areas/learning
loads the areas/_entry
template where I call all of the entry's children and output their content to the page.
The issue is in Live Preview when editing a child entry, such as Our Approach. It looks like Live Preview only likes using the provided entry
variable, but will not update anything nested, found in a loop, or otherwise loaded into the template's context.
For instance, this simplified template code, while rendering as expected, does not update in Live Preview:
{% if craft.request.isLivePreview %}
{% set myEntry = craft.entries.slug(craft.request.getSegment(2)).first() %}
{% endif %}
{% set chapters = myEntry.children %}
{{ myEntry }}
<ul>
{% for chapter in chapters %}
<li>{{chapter}}</li>
{% endfor %}
</ul>
I renamed the entry variable as per this answer. Thoughts?