Follow-up from "Make breadcrumb toggle inline"

The following discussions from !72754 (merged) should be addressed:

  • @splattael started a discussion:

    Suggestion (non-blocking) nitpick: Thoughts on using a more Ruby idiomatic way of initializing a Hash of Arrays?

        @breadcrumb_collapsed_links ||= Hash.new { |hash, location| hash[location] = [] }
        @breadcrumb_collapsed_links[location] << link
  • @splattael started a discussion:

    Suggestion (non-blocking) nitpick: Are we using index somewhere? 🤔

    If not, we could stick with .each instead. WDYT of:

      - @breadcrumb_collapsed_links[dropdown_location].each do |link|
  • @splattael started a discussion:

    Question (non-blocking) I was wondering if instead of using a instance variable directly we could hide this implementation detail in a helper so we don't have to do defined?(@...).

    Marking this question as "non-blocking" also because currently we allow instance variables in HAML via https://gitlab.com/gitlab-org/gitlab/-/blob/914861cdaba35d71f30c42da08e58c2dae6b2f10/.haml-lint.yml#L62-63 and we'd need to discuss if we should disallow them first 😅