GSA / touchpoints

Feedback platform for continuous improvement of systems, services, processes, and policy.
https://touchpoints.digital.gov
Other
44 stars 25 forks source link

Improve client-side handling of failed websocket downloads. #1447

Closed sanason closed 4 weeks ago

sanason commented 1 month ago

The main change here is in what happens if the websocket gets disconnected after the download has been requested but before the response has been received.

Previously, the code would try to reconnect the websocket and, once connected, it would re-request the data. The second download would probably fail too, and the third, and so forth. During all of this, the UI would give no indication of what was happening - it would just continue to display the "Exporting..." label on the export button.

Now, the code gives up after the first disconnect. It then resets the export button and, in place of the data file it was supposed to return, it returns a file with the following text:

We're sorry, your download has failed. That happens sometimes for response sets over several MB's in size.

We're working on fixing this problem. You can monitor our progress at https://github.com/GSA/touchpoints/issues/1446. In the meantime, you can use our API to download large response sets. View API documentation at https://github.com/GSA/touchpoints/wiki/API.

This was the easiest way to signal an error but it's probably not the best user experience. I'm happy to consider a different approach. I'm also happy to change the text.

The PR also fixes some minor problems where the code didn't always restore the original text to the export buttons once exports were complete (i.e., the button read as "Export FY2022" on page load, transitioned to "Exporting..." during export and then transitioned to "Export FY Responses".)