[ 
https://issues.apache.org/jira/browse/WICKET-6840?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17213754#comment-17213754
 ] 

Martin Tzvetanov Grigorov commented on WICKET-6840:
---------------------------------------------------

The following change fixes the issue
{code:java}
diff --git 
wicket-core/src/main/java/org/apache/wicket/page/PartialPageUpdate.java 
wicket-core/src/main/java/org/apache/wicket/page/PartialPageUpdate.java
index ef81182074..7c7498b0ba 100644
--- wicket-core/src/main/java/org/apache/wicket/page/PartialPageUpdate.java
+++ wicket-core/src/main/java/org/apache/wicket/page/PartialPageUpdate.java
@@ -158,13 +158,16 @@ public abstract class PartialPageUpdate
 
                        onBeforeRespond(response);
 
-                       // queue up prepend javascripts. unlike other steps 
these are executed out of order so that
-                       // components can contribute them from inside their 
onbeforerender methods.
+                       // queue up prepend JavaScripts contributed in 
action/callback methods, like onClick(AjaxRequestTarget).
                        writeEvaluations(response, prependJavaScripts);
 
                        // process added components
                        writeComponents(response, encoding);
 
+                       // write any prepend JavaScripts which has been 
contributed in
+                       // Behavior/Component beforeRender/renderHead()
+                       writeEvaluations(response, prependJavaScripts);
+
                        onAfterRespond(response);
 
                        // execute the dom ready javascripts as first 
javascripts
@@ -239,6 +242,7 @@ public abstract class PartialPageUpdate
                        decoratedHeaderResponse.close();
                        
                        writeHeaderContribution(response, 
stringResponse.getBuffer());
+                       scripts.clear();
                }
 {code}
but I think WICKET-6703 broke the idea.

 

Before WICKET-6703 Wicket was using <prepend-evaluation> elements in the Ajax 
XML response, which were processed before any component replacement. After 
WICKET-6703 we use <header-contribution> for both prepend and append JS. With 
the change above the issue is worked around but the prepend JS contributed by 
AjaxIndicatorAppender is executed *after* the component replacements.

A proper fix could be to add an attribute to <header-contribution> saying what 
kind it is, e.g. <header-contribution kind="prepend">, or "append", 
"dom-ready", ... This way wicket-ajax.js could again iterate over all prepend 
contributions before replacing the DOM elements.

 

[~svenmeier] WDYT ?

> Busy indicator persists after request
> -------------------------------------
>
>                 Key: WICKET-6840
>                 URL: https://issues.apache.org/jira/browse/WICKET-6840
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core, wicket-extensions
>    Affects Versions: 9.0.0, 9.1.0
>         Environment: Linux - Ubuntu 19.10 and centOS. Using OpenJDK 14.
>            Reporter: Ronald Cruz
>            Assignee: Martin Tzvetanov Grigorov
>            Priority: Minor
>         Attachments: test_proj.zip
>
>
> The busy indicator (implementations of `IAjaxIndicatorAware`) appears to 
> persist after the AJAX request finishes. To be precise, It looks like it's 
> not being properly cleaned up, as subsequent requests continue to add new 
> indicators to the page. This looks to be new in Wicket 9/9.1, as I didn't 
> observe the behavior in the past (Wicket 7/8) out of the box.
> I've seen this occur with uses of `IndicatingAjaxLink.java` along with 
> ModalWindow/ModalDialog, but also for use cases of the vanilla 
> `AjaxIndicatorAppender` behavior attached to a component.
> I've attached a small quickstart project which should hopefully make this 
> easy to reproduce. It should suffice to start the project and click any of 
> the two links present.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to