Repository navigation
fix: update scroll height when estimation is maxpages times larger than viewport height - #7200
ugur-vaadin wants to merge 10 commits into
Conversation
| forceUpdate || | ||
| this._scrollHeight === 0 || | ||
| this._scrollPosition >= estScrollHeight - this._physicalSize || | ||
| estScrollHeight >= this._maxPages * this._viewportHeight || |
There was a problem hiding this comment.
Yep. Do you think the solution makes sense in general? I can refactor it into the adapter.
There was a problem hiding this comment.
An alternative could be restoring something similar to a removed grid condition to the adapter.
There was a problem hiding this comment.
The issue with the this.grid approach is that I think this.grid in the adapter does not seem to work for a default grid anymore. I am not sure if this is customized for another reason.
There was a problem hiding this comment.
Moved the logic to the adapter. It is a little ugly as the overridden iron list function is possibly called twice. However, it should not affect the performance.
There was a problem hiding this comment.
Regarding this.grid, I think this block can be removed if I am not missing something.
|
| * @override | ||
| */ | ||
| _updateScrollerSize(forceUpdate) { | ||
| super._updateScrollerSize(forceUpdate); |
There was a problem hiding this comment.
Can we avoid the extra call if we move this to an else-block?
There was a problem hiding this comment.
Any call to super._updateScrollerSize updates the estimated scroller size. At that point, the if block would not matter since the _estScrollHeight will have the older estimation.
There was a problem hiding this comment.
That is interesting. I haven't considered that it would. I don't really know why it could. Probably the re-rendering force updates some values. Do you think we should go with that? If so, I think we still should keep the test.
There was a problem hiding this comment.
We would still need to revisit this if another optimization is introduced to avoid extra renders.
There was a problem hiding this comment.
Maybe we can avoid adding extra complexity if the other PR (perhaps accidentally) also fixes the same issue. Agreed, the test should still be added to make sure the grid keeps working as expected in the future.
|
Closing in favour of #7205 |




Description
In
iron-list-core, the scroller size is updated based on some conditions. For some varying item height combinations, these conditions are not met. This leads to the scroller height not being updated, and causes a grid where all rows should visible not having the correct height at first. Scrolling to the end forces the scroller height to be updated later, which changes the grid height.This PR adds another condition to the if clause. This way, the scroller height will also be updated when the estimated scroller height is equal or larger than
_maxPages * _viewportHeight. The value of_maxPagesis constant and set to1.3in order to optimize the number of rendered items. The problems do not reproduce with a similar setup anymore.Fixes #7160
Type of change
Checklist