Ronald Cruz created WICKET-6841:
-----------------------------------

             Summary: Evaluation order of dependent JS in Ajax request
                 Key: WICKET-6841
                 URL: https://issues.apache.org/jira/browse/WICKET-6841
             Project: Wicket
          Issue Type: Bug
          Components: wicket-core
    Affects Versions: 9.0.0, 9.1.0
         Environment: Linux - Ubuntu 19.1, JDK 14
            Reporter: Ronald Cruz
         Attachments: wicket-js-order.zip

Starting in Wicket 9, an issue cropped up with how JS is evaluated when loaded 
through Ajax. It appears as though JS in the component is evaluated before the 
references in <wicket:head> or #renderHead() are resolved. This leads to 
initialization and reference errors in the first rendering if said JS in the 
component references the libraries in the header. Subsequent usages are fine as 
the referenced libraries are then cached.

I'm not familiar with Wicket internals, but this to me seems related to what 
Martin brought up in 
[WICKET-6840|https://issues.apache.org/jira/browse/WICKET-6840]. The comment 
reads:

"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."

I've attached a sample quickstart that is a simplified version of the charting 
issue I mentioned having in that ticket. It is a custom component that pulls a 
simple JS library in the header and calls it inline. The issue can be observed 
through the browser JS console when clicking the link.

 



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

Reply via email to