Open mihob opened 11 months ago
Hyper links can't be eager loaded, as they aren't elements. If we're talking about eager loading through a Hyper field to any custom fields on a link, that's not supported.
If the Hyper link refers to an element like an Entry, that's already heavily cached, and there shouldn't be any performance hits with n+1 queries. Hyper already knows the link information, so there's no performant impact to "fix" with eager loading
Hmm okay, I gotta say, the performance impact compared to TypedLinkField is not exactly small.
Page with TypedLinkField:
Same page after migration to Hyper:
The render time fluctuates somewhat, in the example they are now the same, but in several tests it is rather 30-40ms lower with TypedLinkField.
Above all, the significantly higher RAM requirement is a little concerning.
That's quite interesting to see, last I checked things were nowhere near that different! Just to confirm - are you testing with a single link, linked to an Entry?
There are by nature going to be more database queries, as Hyper fields use field layouts for custom fields, whereas any other link plugin doesn't do this, but that should be roughly the only difference.
There should be about 20 link fields in total. Distributed over the navigation and a "content builder" matrix field. All links are of type entry
So just doing some quick tests, running 10 link fields on a page, all multiple links (5 each) relating to entries, the before and after adding Hyper templating references.
Maybe you can supply:
Sorry for my late reply.
Describe the bug
It looks like eager loading for hyper fields won't work at all.
The following query as an example,
link
is the hyper fieldResults in the following error:
Method craft\elements\ElementCollection::url does not exist.
Steps to reproduce
Craft CMS version
Craft Pro 4.5.11
Plugin version
1.1.16
Multi-site?
Yes
Additional context
No response