Changes to included .lava files aren't picked up without a global cache clear (Fluid engine)
Prerequisites
- [x] Put an X between the brackets on this line if you have done all of the following:
- Did you perform a search at https://github.com/issues?q=is%3Aissue+user%3ASparkDevNetwork+-repo%3ARock to see if your bug or enhancement is already reported?
- Can you reproduce the problem on a fresh install or the demo site?
- Did you include your Rock version number and client culture setting?
Description
When referencing a lava file using an {% include %} tag, changes to the file are not reflected on the page unless I clear the global cache. Changing the block/page cache settings doesn't change the outcome, and the "red running man" icon that bypasses most other caching also doesn't seem to have an effect on this.
Steps to Reproduce
- [Set Lava engine to "Fluid"]
- Create a file
~~/Assets/Lava/test.lavawith the contents "Hello" - Add an HTML block to a page with these contents:
{% include '~~/Assets/Lava/test.lava' %} - Notice that the page shows "Hello"
- Edit the file and change the contents to "Goodbye"
- Notice that the page still shows "Hello"
- Clear the global cache
- Notice that the page now (correctly) shows "Goodbye"
Expected behavior:
If the cache is bypassed (red running man icon), the page should immediately reflect any changes made to an included lava file.
If the cache is enabled (green running man icon), I'm not sure if I should expect external changes to be automatically picked up immediately, or if it would be equivalent to making a change with SQL where Rock doesn't know that it happened without a manual cache clear.
Actual behavior:
The lava template cache prevents the changes from being picked up without a global cache clear regardless of the cache settings.
Note: This template cache is also not clearable from the cache manager. (See #5250)
Versions
- Rock Version: 1.13.7 and 1.15.0.8 (pre-alpha)
- Client Culture Setting: en-US
Hello! Any update on this issue? We're on v15.3 and clearing the Global Cache every time I made a change in a lava file is making development slower.
Dev team, please please include a fix on this if possible with v15.4 or 16.2. Pretty please!
@frogydiak This issue is in the underlying library we use. We have an issue opened with them. We will ping them again. https://github.com/sebastienros/fluid/issues/602
Rock is all about community. A key part of strengthening this bond is knowing who we're engaging with. Could I ask you to include your name, organization, and a photo on your GitHub profile? It's a simple way to put faces to names, fostering a more connected and personal community atmosphere.
@jonedmiston Thank you for the info.
@frogydiak there is a workaround for this issue that was added in 16.1 (https://github.com/SparkDevNetwork/Rock/commit/911fad7dea92cf8f00bc09a4f07400cf69cb16c6) where you can disable template caching with the "running man" icon on the admin toolbar.
@MichaelAllen A quick update...
changes to the file are not reflected on the page unless I clear the global cache.
The compiled include template is cached to provide a significant performance benefit, which we don’t want to lose. However, that cached template automatically expires after 10 minutes, and has been confirmed through some recent testing.
In addition to this automatic refresh, you can manually trigger the cache to refresh without performing a global cache clear by adding a unique variable, comment, or similar element to the include markup. For example:
{% include '~~/Assets/Lava/test.lava', update:'2' %}
{% include '~~/Assets/Lava/test.lava' %} <!-- update 2 -->
or perhaps
{% include '~~/Assets/Lava/test.lava' %} <!-- updated 1/27/2024 2:37pm -->
These changes will modify the cache key, causing the template to be re-cached with the updated content.
Given these additional workaround options, we plan to close this issue. That said, we will continue monitoring the Fluid library for potential enhancements that could allow the compiled template cache to be invalidated automatically when the contents of the include file change.
Thank you again for bringing this up, and we appreciate your understanding as we balance performance optimization with flexibility.
@nairdo The parameter for include is new to me. Would be nice if that is added in the Lava documentation. Include is not even in the Lava docs, I saw it from the lava files that comes with the built-in theme. Maybe there should be a complete list of Lava filters/commands/merge fields or whatever it is called. I didn't know that for you as Rock dev CurrentPerson is not a Lava filter but a merge field, shouldn't that also be in the list of Lava under Merge Fields?
@nairdo The parameter for
includeis new to me. Would be nice if that is added in the Lava documentation. Include is not even in the Lava docs, I saw it from the lava files that comes with the built-in theme. Maybe there should be a complete list of Lava filters/commands/merge fields or whatever it is called. I didn't know that for you as Rock devCurrentPersonis not a Lava filter but a merge field, shouldn't that also be in the list of Lava under Merge Fields?
this has been documented for years https://community.rockrms.com/lava/tags/include-tags this is a tag, not a filter
@frogydiak Could I ask you to include your name, organization, and a photo on your GitHub profile? It's a simple way to put faces to names, fostering a more connected and personal community atmosphere.
@nairdo The parameter for
includeis new to me. Would be nice if that is added in the Lava documentation. Include is not even in the Lava docs, I saw it from the lava files that comes with the built-in theme. Maybe there should be a complete list of Lava filters/commands/merge fields or whatever it is called. I didn't know that for you as Rock devCurrentPersonis not a Lava filter but a merge field, shouldn't that also be in the list of Lava under Merge Fields?this has been documented for years https://community.rockrms.com/lava/tags/include-tags this is a tag, not a filter
Ahhh... I stand corrected @bmurphy-dev, thank you! Apologies @nairdo. I forgot to use my org profile on this post, I will do next time. I guess, I'm just confused with the terminologies used on Lava, sometimes it is called as Lava filter, sometimes Lava Command, sometimes Merge Fields and the documents don't have introduction of what it means. Just a brief comment on Lava file, I personally gave up using it and been using Lava Shortcode lately. It is easier to use (I think) and the result reflects right away after page refresh so, I moved a lot of the code I previously saved as Lava file. We're still developing our website and having to wait for 10 minutes to see your changes is just too long.