Try our conversational search powered by Generative AI!

Content XHR requests infinite loop

Found in

EPiServer.CMS.UI 11.4.7

Fixed in

EPiServer.CMS.UI 11.5.3

(Or a related package)

Created

Jul 03, 2018

Updated

Oct 12, 2018

Area

CMS UI

State

Closed, Fixed and tested


Description

Steps to reproduce:

1. Add code similar to this on any view:

<script>
    function foo() {
        var testDiv = document.createElement("div");
        testDiv.innerHTML = "TEST";
        document.body.appendChild(testDiv);
        document.body.removeChild(testDiv);
    }
 
    setTimeout(foo, 100);
 
    window.addEventListener("resize", foo);
</script>

2. Try to edit a content item in On Page Edit mode that has the above code in its template.

Expected:
No additional xhr requests for the current content data are made.

Actual:
There are infinite requests for the same data in edit UI, fetching metadata and project items.

Note:
This code may seem strange, but a lot of libs/tools related with responsive design hook up to the window.resize event and recreate parts of DOM, which triggers MutationObservers in the Episerver CMS UI. This might manifest itself in different ways:

  • As blinking TinyMCE editor.
  • You cannot scroll to the bottom of a page in edit mode. The scroll jumps up the page.

Easiest way to see if you are affected by this is to use some browser tools and look at the network requests. If your site is affected, you get infinite requests to the metadata and project item store. Requests similar to these ones:

http://localhost/EPiServer/cms/Stores/project-item/?contentLinks=163_167&dojo.preventCache=1531394732637
http://localhost/EPiServer/shell/Stores/metadata/EPiServer.Core.ContentData?modelAccessor=%7B%22contentLink%22%3A%22163_167%22%7D&dojo.preventCache=1531394732551