SideNavItem.setExpanded() has no effect

I’m using a SideNav in an AppLayout. I want to add a subsection which is initally collapsed, so I set setExpanded(false) on the item which has subitems. However, the section is still expanded.
Is this a bug or what could I do possibly wrong here?

(using 24.9.10)

If one of the items inside the parent item matches the current route, the parent will automatically expand.
Otherwise all parent items should be collapsed by default.

In V25 that can be disabled with SideNav::setAutoExpand(false), but not in V24.

Thanks a lot. Indeed I had one subitem with “#” as dummy path. :man_facepalming: