You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, almost all elements are loaded after the View::EVENT_BEFORE_RENDER_PAGE_TEMPLATE event, as they are only requested in the template during rendering.
The only element that can be preloaded (if it is linked) is the entry itself whose template is currently being rendered, as this is already loaded beforehand.
Another problem is that the hyper cache is only created when elements with hyper fields are saved. If the cache is now emptied, it is only rebuilt if the corresponding elements are saved again. In the worst case, this never happens again and you don't benefit from caching at all. Perhaps you should consider a warm-up strategy here.
Steps to reproduce
Craft CMS version
5.5.7
Plugin version
2.2.2
Multi-site?
YES
Additional context
No response
The text was updated successfully, but these errors were encountered:
The way that this is supposed to work, is that when populating an element (any element, not just the one you might be on), it's added to a cache for Hyper to use. This is used rather than querying the element again when trying to render an element-based Hyper link. We figure if you're using a linked-to element in say your navigation, which is run through the ElementQuery::EVENT_AFTER_POPULATE_ELEMENT event, Hyper might as well record that populated element for its own use when rendering that element's link.
Happy to look at this again, but last I checked this was working correctly.
As for the warming strategy, that's correct that there technically isn't one at the moment, but more than happy to introduce a console command to prep this. An un-cached element isn't exactly a massive performance hit, but it would be if it was never cached. For example, in my tests, it really only equated to a few seconds for a few dozen Hyper links on the page when un-cached, and that's down to a few milliseconds when cached after the first hit of a template.
Describe the bug
The documentation states that Hyper loads all cached entry links in a single query. This does not seem to work.
This should probably happen at this point:
hyper/src/Hyper.php
Lines 186 to 215 in d8bb508
However, almost all elements are loaded after the View::EVENT_BEFORE_RENDER_PAGE_TEMPLATE event, as they are only requested in the template during rendering.
The only element that can be preloaded (if it is linked) is the entry itself whose template is currently being rendered, as this is already loaded beforehand.
Another problem is that the hyper cache is only created when elements with hyper fields are saved. If the cache is now emptied, it is only rebuilt if the corresponding elements are saved again. In the worst case, this never happens again and you don't benefit from caching at all. Perhaps you should consider a warm-up strategy here.
Steps to reproduce
Craft CMS version
5.5.7
Plugin version
2.2.2
Multi-site?
YES
Additional context
No response
The text was updated successfully, but these errors were encountered: