Cached block override javascript not correct
Permalink
At 5.7.5.6 I'm having lots and lots of issues with caching in C5 with one specific issue with javascript for blocks. If I turn off caching, all the js gets served and everything works fine.
If I turn caching on, things get wonky. By examining the cached js file, usually the problem is that the block js is just not included in the aggregated block output. Sometimes the block js included multiple times, so I've had to unbind before binding to ensure the correct handler is assigned to the right dom element.
I read a comment somewhere that mentioned how override block caching mechanism is different than other cache types and that clearing cache in the dashboard doesn't actually clear block override cache. Anyone noticing similar problems or know how to clear the cache for block override js. I already tried # rm -rf application/files/cache/*. Is there somewhere else in the fs i can zap? All I can do at the moment is to not cache anything, if I turn off all caching, clear the cache and turn it back on C5 just assembles the js files incorrectly again or omits certain files.
If I turn caching on, things get wonky. By examining the cached js file, usually the problem is that the block js is just not included in the aggregated block output. Sometimes the block js included multiple times, so I've had to unbind before binding to ensure the correct handler is assigned to the right dom element.
I read a comment somewhere that mentioned how override block caching mechanism is different than other cache types and that clearing cache in the dashboard doesn't actually clear block override cache. Anyone noticing similar problems or know how to clear the cache for block override js. I already tried # rm -rf application/files/cache/*. Is there somewhere else in the fs i can zap? All I can do at the moment is to not cache anything, if I turn off all caching, clear the cache and turn it back on C5 just assembles the js files incorrectly again or omits certain files.
Are there any particular block types that cause this issue? Are they core/built in blocks or custom ones?
The one that was being omitted was a js file in a custom template for an overridden autonav block. The other, which was being included more than once was the default view.js for a custom block type and not an override.
After the server settling down a bit, maybe? I've got the first working ok by just disabling the Block Cache option, the other still works ok with a javascript edit to prevent the handler from attaching twice.
After the server settling down a bit, maybe? I've got the first working ok by just disabling the Block Cache option, the other still works ok with a javascript edit to prevent the handler from attaching twice.
Maybe the overidden autonav block controller needs to register the JS/CSS - seehttp://documentation.concrete5.org/developers/assets/registering-an...
I'm relying on the default behavior to include the js file only for the selected template. Think if I edit registerViewAssets in the controller, it would be included for all templates. I didn't notice a template option in your doc link.
OK, so I guess then you're putting your js into "view.js" which would be in the same folder as your view.php?
If so then it ought to be included in the page footer. If you've got the CSS and Javascript cache enabled, you'll hopefully see it right in the footer something like this:
If so then it ought to be included in the page footer. If you've got the CSS and Javascript cache enabled, you'll hopefully see it right in the footer something like this:
<script type="text/javascript" src="/application/files/cache/js/18435bdf7889a3fcba80131993d32875be66bf83.js" data-source="/concrete/blocks/autonav/templates/responsive_header_navigation/view.js /concrete/js/responsive-slides.js /packages/mailchimp/blocks/mailchimp/view.js"></script>
@dennismoore
"At 5.7.5.6 I'm having lots and lots of issues with caching in C5 with one specific issue with javascript for blocks. If I turn off caching, all the js gets served and everything works fine."
If this only occurs when using CSS and JavaScript cache, it may be related to this bug:
http://www.concrete5.org/index.php?cID=796083...
If so, it will be fixed in the next concrete5 release. In the meantime, you can turn CSS and JavaScript cache off.
"At 5.7.5.6 I'm having lots and lots of issues with caching in C5 with one specific issue with javascript for blocks. If I turn off caching, all the js gets served and everything works fine."
If this only occurs when using CSS and JavaScript cache, it may be related to this bug:
http://www.concrete5.org/index.php?cID=796083...
If so, it will be fixed in the next concrete5 release. In the meantime, you can turn CSS and JavaScript cache off.