So it's a global action, and it will e.g. also close library filters when you have (prefer) them in view.
(b.t.w. when those are collapsed in this manner, the right-click context menu still indicates they are shown, which is not the case)
I was hoping for an option to collapse the hierarchy tree individually by using the right-click context menu.