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

Evaluation order of dependent JS in Ajax request

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

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

    Description

      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.

       

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment