Skip to content

Refactor discussion edit widget to have only one at a time.

username-removed-502136 requested to merge single-edit-comment-widget-2 into master

This merge request is a performance improvement for issues and merge requests page. Before this MR, for master users we had one hidden note edit form for every single discussion in the page. This was the reason our DOM is bloated hundreds of unnecessary hidden elements. For example, this MR has 369 discussions in it therefore 16974 hidden elements on the page for edit forms.

With this MR, we will only have one hidden note edit form and we will move it around in the DOM when we want to edit a comment. In Merge Requests page, I also needed to clone and have second hidden edit form because you may want to edit a discussion in MR Discussions tab and also one in the Changes tab.

This MR is like a heavy jQuery stuff, but otherwise it could require a lot of refactor on notes.js. I also considered rewriting them with Vue.js but again, too much refactor would be needed so this is what we have right now.

Reviewer must test this in locally and try to break it. Here is the screencast.

_note-edit-widget

Fixes #23227 (closed)

Merge request reports