-
Notifications
You must be signed in to change notification settings - Fork 16
Adding many rows to grid makes display of rows after scrolling weird #578
Comments
I'm experiencing this too in V13. Grid performance degrades while scrolling, and this is noticeable when there are many items. Not sure if component renderers are the issue, maybe @anasmi can test her code without any component renderer? |
Checked, indeed not related to the Component Renderers. This code produces exactly the same rendering problems and glitch on clicking:
|
Reproducible with the
|
Worth to mention that this reminds me this bug : vaadin/vaadin-combo-box-flow#227 |
I took a look yesterday out of curiosity, and one issue seems to be that it gets stuck in clear->fetch loops. Basically when dragging the scrollbar, the DataCommunicator asks the connector to clear the previously requested range from the cache, and then it sends the new items. Usually the clear method in the connector clears the cache, updates the DOM, but since the cleared items aren’t in the DOM, that’s it. Sometimes, however, it seems the items that were cleared are in the DOM, but since they have been deleted from the cache, the component does the only sensible thing and fetches them again. This causes the DataCommunicator to clear the active items of the last request, and sends the previous items instead, which triggers the same thing. So it goes back and forth between two pages, clearing them and subsequently re-fetching them because they are actually needed. The root cause I have no idea… sometimes when scrolling slowly, the values in a given row change completely, so it seems that the grid has no idea of what indices/rows are actually visible. The loop goes server -> |
I did a little debugging as well. When the Grid gets into a broken state, it easily goes to a loop of requesting data. e.g. |
Yes, when it gets the request to clear the old page, it updates the DOM, and finds real indices for these items, suggesting they are still in view. My theory is that it goes:
And so it continues. If this is the case, then the core issue is why multiple pages are in view at once (or why it incorrectly thinks they are). |
I did the same case with client side Lit element only: import { LitElement, html } from 'lit-element';
import "@vaadin/vaadin-grid"
class GridView extends LitElement {
constructor() {
super();
var element = this;
customElements.whenDefined('vaadin-grid').then(function() {
const grid = element.shadowRoot.getElementById('mygrid');
grid.size = 120000;
grid.dataProvider = function(params, callback) {
console.log(`Fetch: ${params.page * params.pageSize}, Limit: ${params.pageSize}`);
const response = Array.from({length: params.pageSize}, (v, k) => {return {value: params.page * params.pageSize + k}});
setTimeout(() => callback(response), 500);
};
});
}
render() {
return html`
<vaadin-grid id="mygrid">
<vaadin-grid-column path="value"></vaadin-grid-column>
</vaadin-grid>
`;
}
}
customElements.define('grid-view', GridView); Problem 1) is there but problem 3) is not. I'll create a new ticket about 1) to |
Separate issue for #1: https://github.com/vaadin/vaadin-grid/issues/1659 |
I've found the issue in vaadin-grid-flow connector, a fix is coming up. |
PR at #777 |
Nice work Tepi! |
Code to reproduce:
Grid-Flow: 3.0.2
I hope this gif makes more sense, than the vague description:
![grid_scroll](https://user-images.githubusercontent.com/15248706/54108107-c4ce4380-43e3-11e9-9b9a-f678f718657d.gif)
The text was updated successfully, but these errors were encountered: