The error seems to point to your MainLayout constructor
Yeah - I’ll take a closer look -it’s fine until I do a reload
So navigation with the menu bar seems fine
It’s when I reload or open a second tab to the application
Found it - I have a class called UIHelper with a method to get a logo from a file and a method for a
They are both static methods - commenting out the call to them fixes the isuue
Is it not recommended to have some static methods called from the UI?
You can call static methods, but you can’t have Vaadin components in static variables
Ah - so I had this:
if (HI_LOGO == null) {
HI_LOGO = getImageWithWidthHeight(HI_LOGO_PATH,
HI_LOGO_ATL_TEXT,
HI_LOGO_WIDTH_PIXELS,
HI_LOGO_HEIGHT_PIXELS,
Unit.PIXELS);
}
return HI_LOGO;
}
private static Image getImageWithWidthHeight(String imagePath, String altText, int width, int height, Unit units) {
Image image = new Image(getImageAsStreamResource(imagePath), altText);
image.setWidth(width, units);
image.setHeight(height, units);
return image;
}
public static HorizontalLayout HR() {
return new HorizontalLayout() {{
add(new Hr() {{
setWidthFull();
}});
setWidthFull();
}};
}```
It must be the image then
Yes, most likely it’s the HI_LOGO variable
Components exist as server-side objects, but they also need to be synchronized with specific browser tab.
OK - makes sense