When using Views exposed Filters on an Ajax-enabled View, the throbber is added once Ajax is called, but is not removed when the Ajax-Call finishes.
When selecting the "Overlay" option in the Ajax-Loader settings, multiple Loader can be displayed, overlaying each other.
Steps to reproduce
System
- PHP 8.0
Software
- Drupal 9.4.5
- Ajax_Throbber 2.0.1 and/or 2.1.0 (happens with both versions)
Config
- Enable ajax_throbber module
- Create Search-API view (page) with exposed search field
- Enable Ajax on View
- Set "Exposed Filter" to Input Required
- Save View
Action
- Visit search page and execute search => throbber shows and disappears (correct)
- Without reloading the page, execute another search => throbber shows but does not unload
Similar reports
There are other reports on this behavior, one with instructions to open a new ticket if the error is still present on version 2.1.0
Issue fork ajax_loader-3331491
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
mvogel commentedHey, thanks for letting us know about this issue.
I'm sorry, but I couldn't reproduce the error you described. I set up ajax_loader, search_api, and search_api_db made some demo content with devel, and created a search-api view with a required full-text search filter.
Every time I ran multiple searches or used the pager without refreshing the page, the ajax loader was removed when it was supposed to be.
Could you tell me which theme you're using? I tested it with olivero and didn't have any problems. Is the error happening for you with olivero too?
Comment #3
Pierrere commentedHi mvogel,
I am on a custom theme. I'll try to switch to Olivero to see if the problem remains and will update this thread accordingly.
Thanks
Comment #4
eduardo morales albertiSame here, let's see if we can discover why it happens.
Comment #5
eduardo morales albertiIn my case, I have Facets with exposed filters.
When I use the facets the throbber is removed, but when I use the exposed filter of type text, the throbber is added twice and only one is removed.
As a possible solution is to check if the progress element is set before adding it.
Comment #6
eduardo morales albertiComment #8
eduardo morales albertiComment #9
bronismateusz commentedThanks, the Merge request solution solved the problem for me.
Comment #11
mvogel commentedHi,
I still can not reproduce this issue.
However, I can not see any side effects when merging the MR. So, I merged it in dev and will create a new release.
Thanks for your work :)
Comment #12
mvogel commentedI released the 2.1.1 version; please check your use case if possible.
Comment #13
v.koval commenteda new release breaks the expected behavior🤯
Comment #14
eduardo morales alberti@v.koval could you provide more information?
Steps to reproduce, captures...
Comment #15
evilargest commentedThe new release had broken the behavior of the throbber for me.
I have an Ajaxified Views block, and every single result row has my custom Views field. This field has a submit element, that uses an Ajax callback. So, when I submit the row field for the first time, I can see that Ajax is working and the status message appears afterward. But when I click the submit for the second time, the Ajax Throbber does not appear and the status message simply shows after the callback was processed.
However, the Views block I was describing above also has Facets with exposed filters, but it had worked as a charm before the new release. There were no issues with the Ajax loader not being removed when it was supposed to be.
Comment #16
mvogel commentedOh I am sorry to hear that. I will investigate it as soon as possible. For the time being, you can use the 2.1.0 release.
Are there any JS errors in the dev console?
Comment #17
evilargest commentedThanks for the reply!
I haven't noticed any errors in the console since the update. I believe that the
progressIsSetfunction prevents Ajax Loader from appearing more than 1 time for a single element.Comment #18
mvogel commentedI quickly tried to reproduce it. These are my steps.
See the video as an example. Because the ajax call is fast on fresh installs you only see a flashing black rectangle but that is the animation I saved in the ajax_loader settings. The throbber the mounted and unmounted every time for every click on the flag link or pager.
https://www.loom.com/share/513007517ee84822933e88c0ee64fcaa?sid=18c151d3...
Comment #19
evilargest commentedHi, @mvogel! Here are my steps to reproduce the issue:
The link with testing - https://www.loom.com/share/6d713b4f717943098ba9b4fe73b463d4
The code I use for my custom field:
Comment #20
mvogel commentedI can now reproduce this behavior with your steps.
It is still weird, with exposed filter form, pager and ajax link (a-tag) the
this.progress.elementis empty on consecutive ajax calls only with this viewsForm fieldthis.progress.elementis still defined.Comment #22
mvogel commented@EvilArgest and @v.koval could you please test the MR in #3423380 if it fixes your problem?
Comment #23
v.koval commented@mvogel it works for me!
Cheers!✌🏻