Fixes #700: Force scrolling to the top after a render of the operation infinite list
This is a bit hackish, but this is the best solution I've found so far.
I thought we could just call handleScroll()
after the mounting of the infinite list, but that's not correct. At this time, the parent container isn't set up yet, so the heightAbove
property is incorrect in particular, so most computations in handleScroll
end with NaN
and thus 0
.
Alternatives were:
- to call
handleScroll
in the operation list after it's been rendered. This is actually weird, because remembering the scroll position from one section to the other doesn't quite make sense. - instead, I've preferred this solution which forces scrolling to the top of the operation list, which seems to make more sense to me.
It's too bad because it means that in this particular case, the operation list is rendered twice, but in practice this is an edge case, so I think it's fine. (Also happens when we're in the operation list component, scroll down and reload the page, but again I think it's fine)