Hi,
I am using async_cache to load the sidebar, with an event_name setup to do post processing.
<ul id="sidebarRefresh" class="nav nav-tabs nav-stacked">
<%= render_async_cache left_menu_show_path , event_name: "sidebar-loaded", replace_container: false do %>
<li>
<a href="javascript:void(0);">
<i class="fa fa-spinner fa-pulse" aria-hidden="true"></i>
<span class="menu-label" style="font-style: italic;">Loading...</span>
</a>
</li>
<% end %>
</ul>
<%= content_for :render_async %>
This works the first time the page is loaded. Once I reload the same or visit another page, only the HTML is rendered without the vanilla javascript area.
Upon investigation, the code seems to only printing out the cached HTML.
Is there a way to fix this? If I move the post-processing code out of the event listener to $( document ).ready(function() { then it works for reloads but won't work the first time when the cache is null.
Any advice is appreciated.
Hi,
I am using async_cache to load the sidebar, with an event_name setup to do post processing.
This works the first time the page is loaded. Once I reload the same or visit another page, only the HTML is rendered without the vanilla javascript area.
Upon investigation, the code seems to only printing out the cached HTML.
Is there a way to fix this? If I move the post-processing code out of the event listener to
$( document ).ready(function() {then it works for reloads but won't work the first time when the cache is null.Any advice is appreciated.