Fix updating the diff index when switching diff pages from the bottom.
Review Request #13314 — Created Oct. 6, 2023 and submitted
When the diff file index is in docked mode, and the user switches which
page was visible, we would hit an error and the file index would fail to
update as the diff was loading, leaving every file showing a spinner.
The problem is that when the page is scrolled, we redock the items table
elsewhere onto the page. Inside the
#update()method we would load all
the new items, but then reset the
#$itemsvariable to be
(grand)children of the view's element, which was empty because the table
was a child of the banner instead.
I've updated it to explicitly set
trchildren of the
items table. While in here, I realized that the way we're assembling the
items table is quite inefficient, so I fixed this up to assemble all the
child nodes first and then add them all to the DOM at the same time.
- Ran js-tests.
- Switched around between pages of a very large diff. Made sure that
the paginators at both the top and bottom of the page worked