Some customers informed us that my Download-Function in a Vaadin-Dialog downloads a file named “f.txt” instead of the expected Excel. It seems it has something to do with closing the Dialoge before the download is finished
See last comment in Downloading a file randomly results in a f.txt file instead of the real file
Or comment in java - How to mimic click event of anchor tag in Vaadin flow? - Stack Overflow
Currently I have the following function. Closing is called before the InputStream is returned - not nice, but I found no other way to handle it.
Anchor downloadButton = new Anchor(new StreamResource("Excel.xlsx", () -> {
close();
return getExcelInputStream();
}), "");
downloadButton.getElement().setAttribute("download", true);
downloadButton.add(new Button("Download Excel"));
Does anyone have an Idea whether this caused the issue and if yes, how to fix it?