Skip to content

Fix permalink discussion note being collapsed

What does this MR do?

Permalinked MR discussion comments will no longer collapse.


What causes the bug?

The notes tab panes(.notes.tab-pane) is hidden initially until it gets a .active class after the JS kicks in merge_request_tabs.js.es6 -> Contstructor -> activateTab

Previously, if there was a hash in the URL, #notes_xxx, we were clicking the toggle button if the area was hidden, toggler_behavior.js; which even though the discussion is expanded in the server-side render, is actually considered hidden because the hidden notes tab parent,

Summary: If the notes tab doesn't become visible in time, then we click the toggle button which hides the linked discussion. race-condition

You can see the behaviors(toggler_behavior) get required higher up in the bundle than the merge_request/merge_request_tabs: https://gitlab.com/gitlab-org/gitlab-ce/blob/1138afe7c0c0ae2b80b5282aff42e6399328eea8/app/assets/javascripts/application.js#L54-62

toggler_behaviour runs inside a jQuery ready while merge_request is just in an IIFE

Are there points in the code the reviewer needs to double check?

Why was this MR needed?

Screenshots (if relevant)

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Closes #26860 (closed)

Closes #27089 (closed)

Closes #27151 (closed)

Merge request reports