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

Use modern API to cancel requests #1247

Merged
merged 1 commit into from
May 17, 2022
Merged

Use modern API to cancel requests #1247

merged 1 commit into from
May 17, 2022

Conversation

artonge
Copy link
Contributor

@artonge artonge commented May 16, 2022

When double-clicking on a file, the behavior is:
First click: open the viewer
Second click: close the viewer

But the second click does not correctly close the Viewer, as the method used to cancel the requests does not work.

This PR use modern API to cancel the requests. The requests are now correctly aborted, and the openFile method exit because the request call throws an exception.

Fix #893

https://axios-http.com/docs/cancellation
https://developer.mozilla.org/en-US/docs/Web/API/AbortController

@artonge artonge added bug Something isn't working 3. to review Waiting for reviews javascript Javascript related ticket labels May 16, 2022
@artonge artonge added this to the Nextcloud 25 milestone May 16, 2022
@artonge artonge self-assigned this May 16, 2022
Copy link
Member

@skjnldsv skjnldsv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! 🚀

We should do that in more places :)

@skjnldsv
Copy link
Member

/rebase

@skjnldsv
Copy link
Member

/compile amend /

First click: open the viewer
Second click: close the viewer

But the second click does not correctly close the Viewer, as the method used to cancel the requests does not work.

This PR use modern API to cancel the requests. The requests are now correctly aborted, and the `openFile` method exit because the request call throws an exception.

Fix #893

https://axios-http.com/docs/cancellation
https://developer.mozilla.org/en-US/docs/Web/API/AbortController

Signed-off-by: Louis Chemineau <louis@chmn.me>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
@artonge artonge merged commit b4f3988 into master May 17, 2022
@artonge artonge deleted the fix/request_cancelation branch May 17, 2022 08:07
@szaimen
Copy link
Contributor

szaimen commented May 17, 2022

backports?

@artonge
Copy link
Contributor Author

artonge commented May 17, 2022

/backport to stable24

@backportbot-nextcloud backportbot-nextcloud bot added the backport-request Pending backport by the backport-bot label May 17, 2022
@artonge
Copy link
Contributor Author

artonge commented May 17, 2022

/backport to stable23

@artonge
Copy link
Contributor Author

artonge commented May 17, 2022

/backport to stable22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug Something isn't working javascript Javascript related ticket
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The viewer app can no longer be closed after a double click, the lightbox remains black
3 participants