Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-6841

Evaluation order of dependent JS in Ajax request



    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 9.0.0, 9.1.0
    • 9.2.0
    • wicket-core
    • None
    • Linux - Ubuntu 19.1, JDK 14


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



        1. wicket-js-order.zip
          7.04 MB
          Ronald Cruz

        Issue Links



              svenmeier Sven Meier
              roncruz Ronald Cruz
              0 Vote for this issue
              4 Start watching this issue