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

CleanShot_2023-02-21_at_09.37.42_2x

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

CleanShot_2023-01-24_at_17.50.44_2x

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports

Loading