Closed petehjfd closed 4 months ago
If you can create a simpler example that I can reproduce locally without requiring third-party plugins then I’d be happy to test and advise on what could be improved.
I also noticed that your for
loop appears to be closed in the wrong place. I assume it should be:
{% for item in items %}
<article>
{# Some code to output the element here #}
{{ sprig('_components/wishlist-toggle', {'elementId': item.image.id}, {'id': 'wishlist-toggle'}) }}
</article>
{% endfor %}
Closing due to inactivity.
Support Request
Hi Ben
I've got a nested component situation that's not working the way I would exepct and I'm not sure what I'm doing wrong.
The parent component is a 'load more' component, very similar to the example in the cookbook.
I've stripped out some code that's not relevant to the issue:
Inside that component, each item that is 'loaded' has a button that adds the element to a (Verbb) wishlist, very similar to the wishlist example in the cookbook..
For the elements that are loaded on page load, everything works perfectly. However, for the elements that are loaded after clicking the 'Load more' button, the
elementId
that is passed through to the child component is incorrect. Every element gets the sameelementId
, which is the id of the last element in the list of elements loaded on page load.I know nested components can be tricky, but my situation is very similar to the nested components example in the cookbook, so I'm not sure why it's not working. I'm hoping it's something simple!
Any help you can offer would be greatly appreciated.
Many thanks
Plugin Version
2.8.1