verbb / wishlist

A Craft CMS plugin for wishlists for your users to save things to
Other
11 stars 12 forks source link

Eager load wishlist item? #124

Closed thisisjamessmith closed 1 month ago

thisisjamessmith commented 1 year ago

Question

You have the following example code in your docs:

{% for entry in craft.entries.section('news').all() %}
    {% set item = craft.wishlist.item(entry.id) %}

    <a href="{{ item.toggleUrl() }}">Toggle</a>
{% endfor %}

...However, this causes a set of per-entry queries, which on one of my pages adds 700 queries to the page. Is there any way to eager load this info?

Additional context

No response

engram-design commented 1 year ago

Not at the moment. We plan to revamp the API to not have this duplicate querying for starters. As for eager-loading, that's not possible at the moment. You can't really eager-load wishlist items from an entry or other element.

thisisjamessmith commented 1 year ago

ok, thanks for getting back to me

engram-design commented 1 month ago

Updated in 3.0.0