Repository navigation
Description
Description
A Grid column created with addComponentColumn can be hidden with setVisible(false) in the same server round trip that sends new rows, for example together with setItems. When that happens, every new cell of that column starts an endless setTimeout loop in the browser.
With the example below (10 rows), on 25.2.8:
- The page is idle, yet
setTimeoutruns about 2 440 times per second. Every call comes fromFlowComponentDirective.updateContentinflow-component-directive.js. - The node lookups keep failing.
Vaadin.Flow.clients[appId].getByNodeId(nodeid)returnsnullfor 10 node ids, one per new row. Flow never sends components that sit under a hidden column, so these lookups can never succeed. - The loop does not stop on its own. The rate is unchanged 5 seconds later, and nothing in the directive would stop it.
- No connected element carries
__nodeRetryTimeout, so the retrying cells are detached from the document. - The directive re-arms its timer after every failed lookup. It stops only when the node resolves or when Lit calls
disconnected(), and neither happens for these cells.
- No connected element carries
- Showing the column again stops the loop, because the components then arrive.
- Two separate round trips do not trigger it: hiding the column first and replacing the items afterwards gives no loop.
In a production application with three hidden component columns, we measured about 23 000 calls per second. That kept a CPU core busy for as long as the tab stayed open.
Why it happens on 25.2
- The cell content is detached at once, but the rows are rebuilt later.
_hiddenChangedinvaadin-grid-columnremoves the column's cell_contentelements from the DOM immediately._renderColumnTree, which drops hidden columns from the rows, only runs on the next animation frame. - The rows are rendered before that frame. In the same response, the connector's
set()calls__updateVisibleRows()synchronously.__updateRowthen calls the renderer of every cell in the row, including the cells of the hidden column, whose content is already detached. - The lookup can never succeed. The row data still carries the component's
nodeid, because 25.2 generates data for hidden columns. Flow, however, never binds a component under a hidden column. The directive therefore keeps retrying on a detached element.
25.3 avoids this through #6798 ("do not generate data for hidden columns", which fixes #6737):
- On 25.3.0-beta1 and 25.3.0-rc1, the rows sent after hiding the column have no
lr_…_nodeidfield, so the directive has nothing to look up. Grid.Columnhas the newcompositeDataGeneratoronly from 25.3 on.- refactor!: do not generate data for hidden columns #6798 was merged as a breaking refactor, and we found no 25.2 backport.
The unbounded retry in flow-component-directive.js is still unchanged on main.
Our workaround is a Grid subclass with two changes for its component columns:
- the data generator skips generating components while the column element is hidden;
- a
setVisibleoverride callsgetDataCommunicator().reset()when the visibility changes.
Expected outcome
- On 25.2, a hidden component column does not leave cells pointing at components the server never sends. Either refactor!: do not generate data for hidden columns #6798 or a narrower fix could achieve this, for example one that skips only renderer data for hidden columns.
- Independently, the directive stops retrying after a bounded number of attempts, instead of running forever. Any other
nodeidthat never resolves would loop the same way. Stopping only once the cell is detached is not enough: in the second trigger (see the comments), the retrying cells stay connected.
Minimal reproducible example
@Route("")
public class HiddenComponentColumnView extends VerticalLayout {
private final Grid<String> grid = new Grid<>();
private int itemGeneration;
public HiddenComponentColumnView() {
grid.addColumn(item -> item).setHeader("Text");
Grid.Column<String> componentColumn =
grid.addComponentColumn(item -> new Span("component of " + item)).setHeader("Component");
grid.setItems(nextItems());
add(
grid,
new Button(
"Hide the column and replace the items",
click -> {
componentColumn.setVisible(false);
grid.setItems(nextItems());
}),
new Button("Show the column", click -> componentColumn.setVisible(true)),
new Button("Hide the column only", click -> componentColumn.setVisible(false)),
new Button("Replace the items only", click -> grid.setItems(nextItems())));
}
private List<String> nextItems() {
itemGeneration++;
return IntStream.rangeClosed(1, 10).mapToObj(row -> "item " + itemGeneration + "." + row).toList();
}
}Counting snippet for the DevTools console:
(() => {
const originalSetTimeout = window.setTimeout;
let calls = 0;
window.setTimeout = function (...args) {
calls++;
return originalSetTimeout.apply(this, args);
};
originalSetTimeout(() => {
window.setTimeout = originalSetTimeout;
console.log(`setTimeout calls in 1 s: ${calls}`);
}, 1000);
})();Steps to reproduce
- Open the view and run the snippet in the DevTools console. It prints
0. - Click Hide the column and replace the items.
- Run the snippet again. It prints about
2440, and a run a few seconds later prints the same. - Click Show the column. The snippet prints
0again. - For comparison, reload the page, click Hide the column only, and then click Replace the items only. The snippet prints
0.
Environment
Vaadin version(s): 25.2.8 (Flow client 25.2.9, vaadin-grid 25.2.11) and 25.2.7 are affected. Because of #6798, the trigger above does not reproduce on 25.3.0-beta1 and 25.3.0-rc1. The second trigger in the comments does reproduce on 25.3.0-rc1.
Spring Boot 4.1.1, Java 21, development mode
OS: Ubuntu 24.04
Browsers
Chrome
Activity
mkopyczok commentedon Sep 17, 2026
Runnable project with the view above: mkopyczok/vaadin-hidden-component-column-repro
Run
mvn spring-boot:runand openhttp://localhost:8092/. Its README lists the numbers measured per Vaadin version.mkopyczok commentedon Sep 17, 2026
Follow-up: the loops outlive the view, and they add up.
Navigating to another route with
UI.navigate, without a page reload, does not stop them, because nothing renders the detached cells again. Measured on 25.2.8 with the example above plus a second route that has no grid:setTimeoutcalls per secondEach trigger adds new loops to the ones already running. We repeated "hide and replace, navigate away, navigate back" three times, and the rate went 2 450 → 4 880 → 7 350 calls per second. Only a page reload or closing the tab stops them, so a user who keeps the tab open collects more loops with every trigger.
The second route used for this:
In
HiddenComponentColumnView, addnew Button("Go to another view", click -> UI.getCurrent().navigate(OtherView.class)).mkopyczok commentedon Sep 17, 2026
A second trigger, which 25.3.0-rc1 does not fix.
The endless retry also starts when three things happen in one round trip:
setVisible(false);setItems, orgetDataProvider().refreshAll());The hidden column does not have to be a component column; a plain text column is enough. The cells that loop belong to the grid's other component columns, which stay visible. Hiding the only component column gives 0.
Unlike the case in the description, this still loops on 25.3.0-rc1, so #6798 does not cover it.
Measured with the counting snippet from the description, after the click:
setTimeoutcalls per secondgetByNodeIdcannot findA runnable version, with these control cases and the workaround below, is the
/stale-rowsview in mkopyczok/vaadin-hidden-component-column-repro.What seems to happen:
$connector.updateSizeand the others) do not reach the client.setItemsdestroys them, and the same response detaches their nodes.visible=falsechange is sent even under the invisible grid; avisible=truechange is not._hiddenChanged→ (next animation frame)_renderColumnTree→__updateRow, and every component cell of those rows looks up a node that no longer exists. Those cells stay connected to the document and keep retrying, and nothing renders them again until the grid is shown with new rows.Where we hit it. A message list shows an empty-state placeholder with
grid.setVisible(false), and switches between a "From" and a "To" column per folder. Going from a non-empty folder into an empty folder with the other layout looped at ~2 900–11 000 calls per second.Our workaround. We hide the grid with CSS (
display: nonevia a class) instead ofsetVisible(false), and keep its parents visible. The grid stays active, so its row update arrives in the same response, and every path above then measures 0.This makes the bounded retry in
flow-component-directive.js, asked for in the description, more relevant: anynodeidthat stops resolving leaves a loop running, not only one in a hidden column. Here the retrying cells stay connected (all 10 carry__nodeRetryTimeout), so stopping once the cell is detached would not end these loops; only a bounded retry would.[-]Grid (25.2): hiding a component column in the same round trip as new items makes its cells retry `setTimeout` forever[/-][+]Grid: component cells retry `setTimeout` forever when their node never arrives (hidden component column on 25.2; hidden grid also on 25.3)[/+]yuriy-fix commentedon Sep 18, 2026
Dear @mkopyczok, thank you for detailed report! The issue would require further investigation on our side.
fix: remove endless node retry from component directive (#10177) (CP:…
fix: remove endless node retry from component directive (#10177) (CP:…
vaadin-bot commentedon Sep 28, 2026
This ticket/PR has been released with Vaadin 25.2.9.
vaadin-bot commentedon Sep 29, 2026
This ticket/PR has been released with Vaadin 25.4.0-alpha1.
vaadin-bot commentedon Oct 5, 2026
This ticket/PR has been released with Vaadin 25.3.1.