Multi selection Column does not have proper width setup

So I have a grid which has multiselection setup like this.

 static <T> void enableMultiSelect(final Grid<T> grid) {
        final var model = (GridMultiSelectionModel<T>) 
        grid.setSelectionMode(Grid.SelectionMode.MULTI);
        model.setDragSelect(true);
        model.setSelectionColumnFrozen(true);
    }

And then based on size of backend data i make select all visible.

     if (size < 500 && selectionModel instanceof GridMultiSelectionModel<T> multiSelectionModel) {
            multiSelectionModel.setSelectAllCheckboxVisibility(GridMultiSelectionModel.SelectAllCheckboxVisibility.VISIBLE);
        }

It worked fine so far and had no issue related to width of this column until yesterday when i decided to load data async by setting

grid.getDataCommunicator().enablePushUpdates(asyncTaskExecutorBean);

I am using latest vadin version 24.5

Vaadin 24.5 is not supported anymore - consider updating to 24.7.

You could try to call grid.recalculateColumnWidths() once you change the visibility - might be otherwise hard for the grid to keep track because of the asynchronous data supplying

Thanks i updated to vaadin 24.7, i had to add recalculateColumnWidths in fetch call to get it to work. But that comes at a cost of overriding column widths.

Added this inside fetch callback as recalculate was causing performance issue

    grid.getUI().ifPresent(ui -> accessUI(ui, () ->
            grid.getElement().executeJs("this.getElementsByTagName('vaadin-grid-flow-selection-column')[0].width= '35px'")));