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

AJAX loading indicator does not properly stop after receiving a redirect response to a file download #5055

Closed
datune opened this issue Apr 28, 2020 · 10 comments · Fixed by #5321

Comments

@datune
Copy link
Contributor

datune commented Apr 28, 2020

No description provided.

@LukeTowers LukeTowers changed the title AJAX loading indicator does not properly stop after receiving a redirect response AJAX loading indicator does not properly stop after receiving a redirect response to a file download Apr 28, 2020
@bennothommo
Copy link
Contributor

@datune If you have time, would you mind providing us with a test case to the Test plugin demonstrating this issue?

@mjauvin
Copy link
Contributor

mjauvin commented May 4, 2020

I do confirm this behavior.

@bennothommo
Copy link
Contributor

@mjauvin Do you have a test case I can review for it?

@mjauvin
Copy link
Contributor

mjauvin commented May 4, 2020

No, I don't.

@LukeTowers
Copy link
Contributor

@bennothommo

public function onTestRedirect()
{
    return redirect()->to('path/to/file/to/be/downloaded/by/the/browser.csv');
}

@bennothommo
Copy link
Contributor

Thanks @LukeTowers, but I do know how to do a redirect ;). I was simply asking if someone might've set up a link or action with an AJAX handler and the necessary attributes to show the loader, ie. data-load-indicator.

@LukeTowers
Copy link
Contributor

Oh, sorry about that @bennothommo, thought you were confused about the exact implementation of the handler. I believe all AJAX requests in the backend trigger the stripe loading indicator though don't they?

@cosminbosutar
Copy link

cosminbosutar commented May 14, 2020

I have the same behavior.

I have the download page as follows:

title = "Download"
layout = "default"
is_hidden = 0

==
    function onStart()
    {
        $pathToFile = storage_path('static/import-template.xlsx');
        $fileName = 'import-template.xlsx';
        $headers = [
            "Content-Type: => "application/xlsx"
        ];

        return Response::download($pathToFile, $fileName, $headers);
    }
==

I have an ajax handler that redirects to this page:

public function onDownloadImportTemplate(){
    return Redirect::to('download');
}

The steps are the following:

  1. I click the download button
  2. The "onDownloadImportTemplate" ajax handler is executed
  3. I am redirected to the download page
  4. The download prompt is displayed

Everything works as expected until here.

After I finish the download, as mentioned in the title, the AJAX loading indicators (from the top of the page and the loading circle that replaces the mouse pointer) reappear.

The only way to bring the page back to normal is to do a manual refresh.

@bennothommo bennothommo self-assigned this May 15, 2020
@github-actions
Copy link

This issue will be closed and archived in 3 days, as there has been no activity in the last 60 days.
If this issue is still relevant or you would like to see it actioned, please respond and we will re-open this issue.
If this issue is critical to your business, consider joining the Premium Support Program where a Service Level Agreement is offered.

@github-actions
Copy link

This issue will be closed and archived in 3 days, as there has been no activity in the last 60 days.
If this issue is still relevant or you would like to see it actioned, please respond and we will re-open this issue.
If this issue is critical to your business, consider joining the Premium Support Program where a Service Level Agreement is offered.

@bennothommo bennothommo added this to the v1.1.1 milestone Sep 14, 2020
LukeTowers added a commit to wintercms/winter that referenced this issue Apr 9, 2021
…ct response via AJAX.

Fixes: octobercms/october#5555

Tested by wintercms/wn-test-plugin@9fb25e2

Refs:
- octobercms/october#5055 (original issue attempted to solve with previous code)
- octobercms/october#2780 (original issue regarding the hash change redirect not closing the loading indicator)
- octobercms/october@99a0861 (October's solution to the issue)
LukeTowers pushed a commit to wintercms/winter that referenced this issue Apr 9, 2021
…ator (#70)

Fix issue with premature hiding of loading indicators during a redirect response via AJAX.

Fixes: octobercms/october#5555

Tested by wintercms/wn-test-plugin@9fb25e2

Refs:
- octobercms/october#5055 (original issue attempted to solve with previous code)
- octobercms/october#5321 (solution to octobercms/october#5055)
- octobercms/october#2780 (original issue regarding the hash change redirect not closing the loading indicator)
- octobercms/october@99a0861 (October's solution to the issue)
LukeTowers pushed a commit to wintercms/wn-system-module that referenced this issue Apr 9, 2021
…ator (#70)

Fix issue with premature hiding of loading indicators during a redirect response via AJAX.

Fixes: octobercms/october#5555

Tested by wintercms/wn-test-plugin@9fb25e2

Refs:
- octobercms/october#5055 (original issue attempted to solve with previous code)
- octobercms/october#5321 (solution to octobercms/october#5055)
- octobercms/october#2780 (original issue regarding the hash change redirect not closing the loading indicator)
- octobercms/october@99a0861 (October's solution to the issue)
LukeTowers added a commit to wintercms/wn-system-module that referenced this issue Apr 26, 2021
…ct response via AJAX.

Fixes: octobercms/october#5555

Tested by wintercms/wn-test-plugin@9fb25e2

Refs:
- octobercms/october#5055 (original issue attempted to solve with previous code)
- octobercms/october#2780 (original issue regarding the hash change redirect not closing the loading indicator)
- octobercms/october@99a0861 (October's solution to the issue)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

5 participants