Fix collapsed state console error when super sidebar not present
What does this MR do and why?
On pages where the super sidebar is not currently displayed there is a console error
super_sidebar_collapsed_state_manager.js?de3e:22 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'classList')
at toggleSuperSidebarCollapsed (super_sidebar_collapsed_state_manager.js?de3e:22:1)
at initSuperSidebarCollapsedState (super_sidebar_collapsed_state_manager.js?de3e:33:1)
at initSuperSidebar (super_sidebar_bundle.js?9447:12:1)
at eval (main.js?b862:111:1)
This is due to the super sidebar collapsed state manager being initilaised without the required DOM nodes
Update to move initilisation of state manager and binding events to after the if (!el) return false; early return when the .js-super-sidebar DOM node is not present.
Screenshots or screen recordings
How to set up and validate locally
- Enable the feature flag
Feature.enable(:super_sidebar_nav)
- Enable the "New navigation" setting toggle from the user dropdown
- Go to [http://127.0.0.1:3000/-/profile] and view the console
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.

