Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-23634

JSX resources loaded twice when loading docextra tab UIX

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 13.6-rc-1
    • None
    • Unknown

    Description

      Steps to reproduce:

      1. Create a new page with content 
        {{velocity}}$xwiki.jsx.use($doc.getDocumentReference(), {'parameter': 'My Custom Value'}){{/velocity}} 
      1. Create a JSX with "On this page" scope, "Parse content" set to "Yes", "Caching policy" set to "No Caching" and the following code:
        function doSomething() {
          document.getElementById('xwikicontent')?.append($jsontool.serialize("Parameter value: $!request.parameter"));
        }if (document.readyState === "loading") {
          // Loading hasn't finished yet
          document.addEventListener("DOMContentLoaded", doSomething);
        } else {
          // `DOMContentLoaded` has already fired
          doSomething();
        }
      1. On the same page, create a UIX object with executed content "Hello world!", extension point ID "org.xwiki.plaftorm.template.docextra", "Extension ID" "my.example.docextra", Extension Scope "Current Wiki" and the following parameters: 
        show=true
        title=My Tab
        name=myTab
        order=1000 
      2. View the page and click on "My Tab" below the document

      Instead of following these steps, the attached XAR can be imported, then just the last step needs to be done.

      Expected result:

      The content contains "Parameter value: My Custom Value".

      Actual result:

      The content contains the expected results before clicking on "My Tab", but afterwards it contains "Parameter value: My Custom ValueParameter value: "

      This shows that the JSX has been executed twice. This doesn't happen with other docextra tabs that also load JSX like the attachments tab because it's using different code for triggering the loading of JSX.

      Attachments

        Activity

          People

            Unassigned Unassigned
            MichaelHamann Michael Hamann
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: