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

tree.min.css is requested twice on every page view for a logged-in user

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 12.3-rc-1
    • Tree
    • Unknown

    Description

      Reproduction steps

      1. Log in as a user who has edit right on the page
      2. Visit http://localhost:8080/xwiki/bin/view/Sandbox/
      3. Open the browser debugger and make sure that "disable cache" is unchecked
      4. Click on the "Sandbox Test Page 1" link and observe the network tab

      Expected

      tree.min.css?evaluate=true is requested at most once per page view.

      Actual

      It is requested twice, and since it is served with Expires: Thu, 01 Jan 1970 00:00:00 GMT neither response can be reused. That is 2 × 30.6 KB = 62 KB transferred on every single page view.

      For comparison, the total amount transferred on a warm-cache page view is about 87 KB, so this one stylesheet accounts for roughly 70% of it.

      A guest requests it only once, which is the clue to the cause.

      Analysis

      The two requests have different initiators:

      • the <link> emitted in the page itself, for the tree used by the Navigation panel and by the export tree modal;
      • a second one injected from JavaScript by CKEditor/InlineEditor, which is loaded in view mode by the in-place editing preload (see the companion issue about that preload).

      Hence the difference between a guest and a user with edit right.

      Note that the fact this stylesheet is not cacheable at all is a separate, already reported problem: XWIKI-22935. The two issues compound each other — the duplication only costs bandwidth on every page view because the response cannot be cached — but they can be fixed independently.

      Suggested fix

      Avoid the second injection when the stylesheet is already present in the page. Fixing the in-place editing preload so that CKEditor is not loaded in view mode at all also removes this second request as a side effect.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mleduc Manuel Leduc
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated: