dash-resumable-upload icon indicating copy to clipboard operation
dash-resumable-upload copied to clipboard

[bugfix/react-version-16] Updating to latest version of Dash and React version 16

Open westonkjones opened this issue 5 years ago • 3 comments

This updates dependencies to comply with React version 16

westonkjones avatar Jun 05 '19 16:06 westonkjones

This seems the appropriate place to ask this, since I cannot open an issue in your fork.

When the dash app is connected with another app (flask or dash) via DispatcherMiddleware then the Upload button doesn't work. It sends a POST request to /dash_resumable which I suspected was the case due to this line: https://github.com/westonkjones/dash-resumable-upload/blob/master/dash_resumable_upload/init.py#L44

For my case I went sideways by just pointing to the main Flask app, but if I wanted to fix it, do you have any idea what I need to change? I tried changing that line (and #L76) to something like app.config.requests_pathname_prefix + "upload_resumable" but it still seems to send POST requests to /upload_resumable.

KMouratidis avatar Sep 26 '19 11:09 KMouratidis

@KMouratidis I'm skeptical that the component would be able to find your app config. Even if it does it may be good design to allow inversion of control over the route prefix.

I suggest trying to update the decorate_server method to allow a route-prefix parameter on line 40

def decorate_server(server, temp_base, requests_pathname_prefix=""):

You would then need to update all of the route annotations to be

@server.route(f"{requests_pathname_prefix}/upload_resumable", methods=['POST']) @server.route(f"{requests_pathname_prefix}/upload_resumable", methods=['GET'])

Note that you may have to add a / to the front of requests_pathname_prefix in your app.config or do some logic to handle it

Then when calling this in the container you can pass the value from your config. To use the example from line 9 of usage.py

dash_resumable_upload.decorate_server(app.server, "uploads", app.config.requests_pathname_prefix)

I have enabled issues on my fork of this repository. If you would like to continue development on top of my fix I invite you to clone my fork and open a pull request there and we can roll up PRs into @rmarren1's repository eventually. This PR is already 4 months old and I'd hate to see it balloon in scope and delay approval

westonkjones avatar Sep 27 '19 05:09 westonkjones

We have been using this fix in the master version of my fork for an application for genomic research without issue since this PR was opened 4 months ago.

westonkjones avatar Sep 27 '19 15:09 westonkjones