blueriver / MuraJS

Other
13 stars 9 forks source link

Specifying data-objectParams-preloadermarkup crashed requests when editing. #8

Open David-Polehonski opened 5 years ago

David-Polehonski commented 5 years ago

Attempting to specify a value for objectParams.preloadermarkup crashes requests when using the layout manager as the markup is serialised into the URL and can easily exceed browser limits.

I've resolved the issue locally with a custom distribution of mura.js where I've modified the processAync request to use a post request instead.

if(typeof data.preloadermarkup != 'undefined'){
  self.innerHTML = data.preloadermarkup;
} else {
  self.innerHTML = Mura.preloaderMarkup;
}

ajax({
  url: Mura.apiEndpoint + '?method=processAsyncObject',
  type: 'post',
  data: data,
  success: function(resp) {
    handleResponse(obj,resp);
    if (typeof resolve =='function') {
      if(typeof resolve.call == 'undefined'){
    resolve(obj);
      } else { 
        resolve.call(obj.node, obj);
      }
    }
  }
});                 
mattlevine commented 5 years ago

I put in a partial fix. I'm still thinking about any potential issue moving from get to post perhaps related to browser caching or something.

David-Polehonski commented 5 years ago

Removing the markup from the request should resolve the issue but I could find no evidence to indicate whether this was required on the server-side or not.