Open DanielDarrenJones opened 5 months ago
I noticed this pre-v5 but hoped the augmentation changes might avoid it. It feels to me that the results of augment() in the assets field type should be blinked, are there any downsides to that?
The same issue happens with other relationship field types (eg entries).
[edit] I think the issue is they return query builders, not a collection, so not sure how possible it would be to Blink them.
FWIW... as a workaround I've managed to cut down the number of asset queries by reassigning the asset field to a new variable before accessing properties. Seemingly when reassigned, the new varaible no longer queries when accessing properties. For example: `{{new_image_field = image_field}}
`
Bug description
If you access a variable on an asset fieldtype directly using a colon like so:
A query will be performed for each variable you access, this could potentially be reduced by implementing blink caching here, otherwise we could document this behaviour in the docs, let me know which you would prefer and I can submit a PR?
How to reproduce
Add a asset fieldtype with a limit of 1 to an entry, access the field in antlers like so:
Each additional attribute you access will make an additional SQL query (I have only tested this on the eloquent driver).
Logs
No response
Environment
Installation
Fresh statamic/statamic site via CLI
Additional details
No response