Update the diff file index when diffs are expanded/collapsed.
Review Request #13235 — Created Aug. 23, 2023 and submitted
The diff file index in the Unified Banner only updated extents when new
diffs were added, when going into docked mode, or on window resize. If a
diff was expanded or collapsed, the diff file index didn't know about
this, and could present the wrong entries for the current view.We now use a
ResizeObserver
to track resizes to all the diffs,
updating the extents whenever a resize is detected.To avoid duplicate calls to
updateLayout()
where this is computed
(which could occur due to a window resize alone, or a window resize
along with aResizeObserver
event), we now call a
queueUpdateLayout()
function, which will userequestAnimationFrame()
to scheduleupdateLayout()
. This, along with storing a request ID,
prevents us from doing any unnecessary work that could lead to sluggish
resizes.
Unit tests pass.
Tested expanding and collapsing diffs, resizing the window, and manually
altering the DOM, verifying that layout updates were always called and
the diff file index always showed the correct result.
Summary | ID |
---|---|
2f73b653b662ca07f738efdbc3d766b4b897310d |