Hi!
I've been trying to use the FileDownload widget to allow my users to download data from a dashboard. I wanted filename to be updated according to some parameters. While looking for a way to do that, I found a potential bug.
To reproduce the example below, you'll need to have a file called data.csv in your repo. It shows that when you create a widget and update its button_type, it's correctly updated. However, after you've clicked once on the button, every time you update button_type again the Download window pops up. I observed the same behaviour trying to update filename. Note that updating label doesn't have this unwanted side effect.

I believe the issue comes from the fact that the render function of panel/models/file_download.ts watches filename, button_type (and data). After render runs once, the attribute _initialized is set to True, every new change of one of these attributes will trigger a click:
Thanks for the detailed issue and for tracking down the actual bug. Any chance you could send a quick PR our way? 馃槃
Ok I'm gonna give it a try! However, I don't expect my first attempt to be successful, I might need some guidance at some point ;) Let's see how it goes!
Hi @maximlt
Thanks for taking the time to put in a good description.
On thing that I find help full sometimes is to add a small video .gif to show whats going on. It's sometimes difficult sitting on the other side of an issue and trying to understand what the issue is or to reproduce it.
I use SceenToGif to do that.
If I was to take a look at this issue I think it would really have helped me to see the video.
A picture says more than a thousand words. A video .gif even more :-)
Fixed in #1246