Image in grid are all same for all rows

I have a grid that I’m trying to show images on. It has some very strange behavior. Here is the code:

Blockquotegrid.addComponentColumn(jd->{
log.debug(“adding images to list: image:{}”,jd.getLabelImageFilename());
Image img = imageUtils.getImage(jd.getLabelImageFilename(),ImageUtils.ImageSize.small);
return img;

	}).setHeader("Label").setSortable(false);

The images are different from every row, but the grid will show all rows with the image from the last row. When I sort - then whatever the last row is, the image from the last row is set for all rows.

Anything obvious?

I suspect your implementation of getImage returns the same instance every time it’s called?

This works as expected for me:

Grid<String> grid = new Grid<>();
grid.addComponentColumn(row -> {
   return new Image(row, ""); 
});
grid.setItems("image1.png", "image2.png");

Make sure, you create a new Image instance for each row.
You could also use a LitRenderer instead of a ComponentRenderer, but that would require an endpoint that calls the imageUtils…