This is from a template that worked in Craft 2, but doesn't in Craft 3.
{% set entries = craft.entries.type('publications').orderBy("postDate desc") %}
entries.count() outputs 80
{% for cat in allCats %}
{% set catEntries = entries.relatedTo(cat) %}
{% if catEntries | length or cat.slug=="all" or cat.slug=="toutes" %}
<li><a href="{{ cat.url }}" {% if category is defined and cat.slug == category.slug %}class="current"{% endif %}>{{ cat.title }}</a></li>
{% endif %}
{% endfor %}
This iterates through all categories with correct entries associated
After that, entries.count() outputs 0
Looks like entries is getting set to the last value instead of just passing the resulting object to the variable. This is not how it worked before. Is there a way to reset this ?