[How To - Lazy load] LazyLoad blocks any link click

[How To - Lazy load] LazyLoad blocks any link click

  
Forge Component
(17)
Published on 2014-07-15 by Francisco Menezes
17 votes
Published on 2014-07-15 by Francisco Menezes

Hi,

I tried this on version 9 on development env. I have a homepage with some components with lazy load and with a menu. If I click on any link of the menu the new page only start opening when the lazy load finish his job. Will this be different in a production env?

afaik nope,


You should check out the other lazy-load with fakenotify and multiple loads.

there you have something like end up soemthing like:

if(!window.LateLoadQueue) {window.LateLoadQueue = [];}
window.LateLoadQueue.push({ weight: "+PriorityWeight+", id: '" + NotifyWidget.Id + "'});
window.LateLoadQueue.sort(function(a, b) {return a.weight < b.weight;});
$( document ).ready(
    function () { 
        for(i = 0; i < window.LateLoadQueue.length; i++) {
          if(lazyLoadPropogation) {
            OsNotifyWidget(window.LateLoadQueue.shift().id, '');
          }
      }
    }
);

there you can hook a js-variable to see if you really want to notify or something else has propagated.

when clicking on any link, you should set that variable to false and the next time the fakenotify is being called it will stop.

That helps to change page between different blocks loading. But if one block takes 1 min to load and the link click happen during the load of that block the user will wait 1 min for the page to change. There is anyway of avoiding this?

Thx in advance.

Hi Marcelo.

Your pages shouldn't take up to 1 minute to load, anyway.

What happens here is that the platform serializes dynamic web requests for the same session. That is done by design mainly to prevent inconsistent state in session objects. Imagine having two different requests reading and writing concurrently to the same session object.

I don't think there's any way around this mechanism. But, if your menu links are navigate (or submit), your browser should give priority to it and in that case it would be the next web request to be served. So you would have to wait, at most, the time for the current lazy web block to load.