You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Sebastien <se...@gmail.com> on 2016/11/25 14:47:57 UTC

LDM reloaded several times

Hi all,

Following a recent discussion about LDM being reloaded several times [1],
I've prepared a quickstart [2].

My concern was the following: I was thinking that a LDM relying on another
LDM, and reused on several components may have been reloaded several times
(because of the component's #reload which could have been called to early).

It seems to not be the case. Good news!

Then, I realized that I was using the LDM as a component model *and* in an
AjaxBehavior [3]. Of course, the AjaxBehavior initiate a new request,
causing the LDM to be reloaded.

I do not expect a solution here, it's just a wrong usage on my side. But as
I started the discussion, I wanted to loop the loop! :)

Thanks & best regards,
Sebastien.

[1] http://markmail.org/message/lmg2zrfuovn4fhgg
[2] https://github.com/sebfz1/wicket-quickstart-ldm
[3]
https://github.com/sebfz1/wicket-quickstart-ldm/blob/master/src/main/java/quickstart/QuickstartPage2.java

Re: LDM reloaded several times

Posted by Sebastien <se...@gmail.com>.
Hi Ernesto,

(sorry for the delay in my reply)

No, I don't think so (if I understood your question correctly). The ajax
request is called from the page once loaded, i.e. really after the page's
request cycle.
I can trick by passing a non-detachable-chaining-model to page components
and let the behavior detach the model at the end of its request [1]... Not
very nice but it works :)

[1]
https://github.com/sebfz1/wicket-quickstart-ldm/blob/master/src/main/java/quickstart/QuickstartPage2.java

Thanks & best regards,
Sebastien.


On Fri, Nov 25, 2016 at 4:06 PM, Ernesto Reinaldo Barreiro <
reiern70@gmail.com> wrote:

> @Sebastian,
>
> Would a model that only detaches itself if there is no request target
> scheduled after current work for your use case?
>

Re: LDM reloaded several times

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
@Sebastian,

Would a model that only detaches itself if there is no request target
scheduled after current work for your use case?

On Fri, Nov 25, 2016 at 4:00 PM, Sebastien <se...@gmail.com> wrote:

> Hi Martin
>
> On Fri, Nov 25, 2016 at 3:52 PM, Martin Grigorov <mg...@apache.org>
> wrote:
>
> > Hi Sebastien,
> >
> > Seems to work as designed! :-)
> >
>
> Yes definitely! sorry to have had a doubt! :D
>
>
> > The Ajax request is in a second request cycle so it loads it again.
> > I guess you can create some kind of ConversationModel (CDI conversations)
> > but this is totally different model impl.
> >
>
> Good to know, thanks!
>



-- 
Regards - Ernesto Reinaldo Barreiro

Re: LDM reloaded several times

Posted by Sebastien <se...@gmail.com>.
Hi Martin

On Fri, Nov 25, 2016 at 3:52 PM, Martin Grigorov <mg...@apache.org>
wrote:

> Hi Sebastien,
>
> Seems to work as designed! :-)
>

Yes definitely! sorry to have had a doubt! :D


> The Ajax request is in a second request cycle so it loads it again.
> I guess you can create some kind of ConversationModel (CDI conversations)
> but this is totally different model impl.
>

Good to know, thanks!

Re: LDM reloaded several times

Posted by Martin Grigorov <mg...@apache.org>.
Hi Sebastien,

Seems to work as designed! :-)
The Ajax request is in a second request cycle so it loads it again.
I guess you can create some kind of ConversationModel (CDI conversations)
but this is totally different model impl.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Fri, Nov 25, 2016 at 3:47 PM, Sebastien <se...@gmail.com> wrote:

> Hi all,
>
> Following a recent discussion about LDM being reloaded several times [1],
> I've prepared a quickstart [2].
>
> My concern was the following: I was thinking that a LDM relying on another
> LDM, and reused on several components may have been reloaded several times
> (because of the component's #reload which could have been called to early).
>
> It seems to not be the case. Good news!
>
> Then, I realized that I was using the LDM as a component model *and* in an
> AjaxBehavior [3]. Of course, the AjaxBehavior initiate a new request,
> causing the LDM to be reloaded.
>
> I do not expect a solution here, it's just a wrong usage on my side. But as
> I started the discussion, I wanted to loop the loop! :)
>
> Thanks & best regards,
> Sebastien.
>
> [1] http://markmail.org/message/lmg2zrfuovn4fhgg
> [2] https://github.com/sebfz1/wicket-quickstart-ldm
> [3]
> https://github.com/sebfz1/wicket-quickstart-ldm/blob/master/src/main/java/
> quickstart/QuickstartPage2.java
>