Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grid renders empty rows when using "setPageSize" #8693

Open
probert94 opened this issue Feb 19, 2025 · 0 comments
Open

Grid renders empty rows when using "setPageSize" #8693

probert94 opened this issue Feb 19, 2025 · 0 comments
Assignees
Labels
BFP Bug fix prioritised by a customer

Comments

@probert94
Copy link

Description

In our application we have a Grid that displays items of a selected order. The pagesize of the grid depends on some settings and might change when selecting an order. The grid starts with 0 items, as no order is selected.
As soon as you select an order, the items and the pagesize are set.
Since Vaadin version 24.5.0 this causes the grid to render empty rows instead of the items.
I was able to narrow down the issue to ef3d165.

The problem is that changes to the size now clear the pending requests. In my case it seems like there is still a pending request, wehn the size gets changed to "0" from a gridConnector#reset call. Before this change, subsequent item refreshes were skipped as the request was still pending. Now the items are refreshed which causes the tr elements to be hidden (size = 0).

My current workaround is to revert the changes by using patching the Cache-prototype:
Object.defineProperty(Cache.prototype, "size", { get: function() { return this.__size; }, set: function(v) { this.__size = v; } });

Expected outcome

The grid should render the rows normally

Minimal reproducible example

public MainView() {
    var grid = new Grid<Integer>();
    grid.addColumn(item -> item);
    grid.setSelectionMode(Grid.SelectionMode.SINGLE);
    add(grid);

    Button refreshBtn = new Button(VaadinIcon.REFRESH.create());
    refreshBtn.addClickListener(e -> {
        grid.setItems(IntStream.range(0, 200).boxed().toList());
        grid.setPageSize(100);
    });
    add(refreshBtn);
}

Steps to reproduce

  1. Use the code pasted above
  2. Open the page
  3. Click the refresh button

Environment

Vaadin version(s): Since 24.5.0

Browsers

Issue is not browser related

@web-padawan web-padawan added the BFP Bug fix prioritised by a customer label Feb 19, 2025
@sissbruecker sissbruecker self-assigned this Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BFP Bug fix prioritised by a customer
Projects
None yet
Development

No branches or pull requests

3 participants