Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List of bugs related to the FileDownload widget #1299

Closed
maximlt opened this issue Apr 24, 2020 · 0 comments · Fixed by #1306
Closed

List of bugs related to the FileDownload widget #1299

maximlt opened this issue Apr 24, 2020 · 0 comments · Fixed by #1306
Milestone

Comments

@maximlt
Copy link
Member

maximlt commented Apr 24, 2020

Fixing #1246 allowed me to dig into the code and better understand the behaviour of the FileDownload widget. I spotted some bugs that add up to this one #1289. Before submitting a PR, I wanted to list these bugs here.

The first one is quite bad, the last example in the Reference Gallery (here) is actually broken. At first selecting a year (here 1970) and downloading the generated data works fine. Doing it a second time with another year seems to work fine but the data that is actually downloaded is the same data again, it hasn't been updated.
filedownload-broken-gallery

Here is another (minimal) example to reproduce this bug:

from io import StringIO

opts = pn.widgets.Select(options=["a", "b", "c"])

@pn.depends(opts)
def cb(opts):
    return StringIO(opts)

fd = pn.widgets.FileDownload(callback=cb, filename="data.txt")
pn.Column(opts, fd).show()

The data available from the widget will always be the first one downloaded, it won't be updated.

Then there is a series of possibly related bugs. They occur after the widget is clicked and that its data/parameters are updated, the Save window pops up at each change. Also note that the disabled property isn't part of the documented API (see the docs) but the widget inherits it. It doesn't actually disable the widget while this would be a useful feature for such a widget.
filedownload-broken-ui

Here is the code to reproduce that:

from io import StringIO
fd = FD(file=StringIO("data"), filename="data.txt")
pn.Row(fd, fd.controls()).show()

I've been working on a PR that tries to tackle these bugs one by one (I wasn't aware of #1289 though). It's a rather slow process, mostly because of my inexistent html/typescript skills, as the root cause of all these bugs seem to arise from there.

@philippjfr I'll submit what I have done so far at some point during the week-end so that you can check whether I went in the right direction.

@philippjfr philippjfr added this to the v0.10.0 milestone Apr 28, 2020
@philippjfr philippjfr modified the milestones: v0.10.0, v0.9.6 Jun 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants