This issue has been created
There are 2 updates.
 
 
XWiki Platform / cid:jira-generated-image-avatar-0f4a0cab-800f-4b25-a569-fffedb1459f2 XWIKI-23634 Open

JSX resources loaded twice when loading docextra tab UIX

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-daa6c4b2-ce01-4569-abd4-e83e855f8ae0 Michael Hamann created this issue on 27/Oct/25 11:35
 
Summary: JSX resources loaded twice when loading docextra tab UIX
Issue Type: cid:jira-generated-image-avatar-0f4a0cab-800f-4b25-a569-fffedb1459f2 Bug
Affects Versions: 13.6-rc-1
Assignee: Unassigned
Components: Web - Templates & Resources
Created: 27/Oct/25 11:35
Priority: cid:jira-generated-image-static-major-e52977ae-f486-4517-add4-e70354074050 Major
Reporter: Michael Hamann
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

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.

 
 

2 updates

 
cid:jira-generated-image-avatar-daa6c4b2-ce01-4569-abd4-e83e855f8ae0 Changes by Michael Hamann on 27/Oct/25 11:36
 
Description: *Steps to reproduce:*
# Create a new page with content 
{code:java}
{{velocity}}$xwiki.jsx.use($doc.getDocumentReference(), {'parameter': 'My Custom Value'}){{/velocity}} {code}

# Create a JSX with "On this page" scope, "Parse content" set to "Yes", "Caching policy" set to "No Caching" and the following code:
{code:javascript}
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();
}{code}

# 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: 
{code:java}
show=true
title=My Tab
name=myTab
order=1000 {code}
# 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.
Attachment: Page+with+UIX.WebHome.xar