How to use lazy-load?

79 views
Skip to first unread message

Jeppe Nejsum Madsen

unread,
Mar 8, 2010, 9:31:27 AM3/8/10
to lif...@googlegroups.com
Hi,

I have a page with a somewhat lengthy first-time load. So I found
lazy-load that looked handy, but it doesn't seem to work. This is my
template:

<lift:surround with="wide" at="content">
<h2>Udvikling per måned</h2>
<lift:lazy-load>
<lift:performanceChart>
<div class="span-5">
Vis:<br/>
<performance:mapReduce/><br/>
Opdel efter:<br/>
<performance:groupBy/>
</div>
<div class="column span-19 last">
<performance:chart/>
<div id="table"><performance:dataTable/></div>
</div>
</lift:performanceChart>
</lift:lazy-load>
</lift:surround>

Nothing in the performanceChart snippet is rendered when wrapped with
lazy-load (but I see from the logs that the snippet as being called)

If I wait a while, I can see the comet actor shutdown:

15:29:55.096 [ool-2-thread-13] INFO lift
- The CometActor
net.liftweb.builtin.snippet.AsyncRenderComet@131e8e72 Received
Shutdown

What am I missing?

/Jeppe

Marius

unread,
Mar 8, 2010, 11:42:57 AM3/8/10
to Lift
Can you please send me a minimalistic example ? .. The comet actor
shutdown looks correct to me as after the lazy content is rendered
that comet is not needed anymore.

Can you check with firebug if you get any asynchronous javascript back
from the comet request?

Jeppe Nejsum Madsen

unread,
Mar 8, 2010, 3:54:08 PM3/8/10
to lif...@googlegroups.com
On Mon, Mar 8, 2010 at 5:42 PM, Marius <marius...@gmail.com> wrote:
> Can you please send me a minimalistic example ? .. The comet actor
> shutdown looks correct to me as after the lazy content is rendered
> that comet is not needed anymore.

Not easily. When I get some time I'll see if I can reproduce it in a sample.

> Can you check with firebug if you get any asynchronous javascript back
> from the comet request?

It looks a bit strange. The normal request (with not lazy load) is
about 3s. With the lazy load the comet request is almost 60s before
anything (not the correct content) is returned (timed out?)

Hold on! I did some more digging :-) Since this was just a naive
application of lazy-load around an existing snippet, it contained bind
with a few ajaxSelects inside. It seems this is what caused the
problems. If I remove the ajaxSelects it seems to work.

Not sure if this is a supported scenario or not, but if not we should
probably emit some notification when running in dev mode.....or at
least document what can be put inside lazy-load

/Jeppe

Marius

unread,
Mar 9, 2010, 6:21:05 AM3/9/10
to Lift
I assume you are using Lift from master ...

lazy-load should be able to wrap anything. I'll try to put in some
ajaxSelects to see if I can repro.

On Mar 8, 10:54 pm, Jeppe Nejsum Madsen <je...@ingolfs.dk> wrote:

Marius

unread,
Mar 9, 2010, 11:08:54 AM3/9/10
to Lift
Dear Jeppe,

I spent some time today in looking to your issue. I was able to
reproduce. The problem was that a NPE was thrown as the S,functionsMap
was not initialized as I was doing a light S init to capture original
request state. I have a fix for it but I need to do some more testing
on it first.

I'll open a ticket for this.

Br's,
Marius

Marius

unread,
Mar 9, 2010, 12:30:38 PM3/9/10
to Lift
I opened defect 412 and this is now on the review board:
http://reviewboard.liftweb.net/r/263/diff/#index_header

Jeppe Nejsum Madsen

unread,
Mar 9, 2010, 2:51:27 PM3/9/10
to lif...@googlegroups.com
Marius <marius...@gmail.com> writes:

> I opened defect 412 and this is now on the review board:
> http://reviewboard.liftweb.net/r/263/diff/#index_header

Wow, that was fast :-) Thanks for looking into this!

/Jeppe

Reply all
Reply to author
Forward
0 new messages