navigation – The “is-active” class is added to the main-menu links only when the site is accessed by an anonymous user

I use this simple template (menu–main.html.twig) to render the main menu I created.

    {% for item in items %}
        {{ link(item.title, item.url) }}
        {% if item.below is not empty %}
            <div class='submenu'>
                {% for subitem in item.below %}
                    {{ link(subitem.title, subitem.url) }}
                {% endfor %}
        {% endif %}
    {% endfor %}

Drupal is nice enough to add an is-active class to the currently active link, which is good and worked fine for a bit.

Recently, it stopped working properly and I have no idea why. Currently it is only applying an is-active class to the menu links when I am not logged in. When I log in, there is only a menu link that gets that class applied to it when active.

The menu links are identical, apart title and destination on the Edit Menu Link menu, so I’m very confused.

Can anybody offer suggestions for things to try to help solve this problem?