#children and Ajax

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

#children and Ajax

Sophie424
I'm encountering some seemingly not-systematic "Children Not Found while
processing callbacks" that I don't understand.

Perhaps I did not fully understand this earlier advice from Lukas:

> - Don't try to replace children during AJAX actions without specific
> precautions. E.g. you have to make sure that all the children you are
> possibly going to show are returned by #children. See SUTabPanel and
> SUAccordion for examples.

Is it safe to dynamically add newly created components? These would not be
in the previous call to #children, but will be included in the next
#children e.g.

C>>children
    ^ subComponents

C>>render...
    onClick: (html updater
        ...
        callback: [:r | subComponents add: C new.
            self basicRenderOn: r ])

Thanks - Sophie




_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: #children and Ajax

Lukas Renggli
> I'm encountering some seemingly not-systematic "Children Not Found while
> processing callbacks" that I don't understand.

Related to backtracking?

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: #children and Ajax

Sebastian Sastre-2
In reply to this post by Sophie424
Hi Sophie,

        I'm not using it the feature right now but I had that problem and
Lukas gave me a clue to solve it.

        The problem is when a component that was replaced with some AJAX
action remains obsolete when called by a backtrack.

        My solution was to make an #obseletes instVar where I collect the
children components that are being obsoleted by this AJAX actions. So
#children will allways answer the actual valid children components but also
the obsoletes ones. The obsoletes are never rendered but in case of a
backtrack they make all work as expected.

        Again, as I said, I was not convinced to use AJAX that way at all
until we have a full ajaxian backtrack solution.

        cheers,

Sebastian Sastre


> -----Mensaje original-----
> De: [hidden email]
> [mailto:[hidden email]] En nombre
> de itsme213
> Enviado el: Viernes, 18 de Enero de 2008 22:43
> Para: [hidden email]
> Asunto: [Seaside] #children and Ajax
>
> I'm encountering some seemingly not-systematic "Children Not
> Found while processing callbacks" that I don't understand.
>
> Perhaps I did not fully understand this earlier advice from Lukas:
>
> > - Don't try to replace children during AJAX actions without
> specific
> > precautions. E.g. you have to make sure that all the
> children you are
> > possibly going to show are returned by #children. See
> SUTabPanel and
> > SUAccordion for examples.
>
> Is it safe to dynamically add newly created components? These
> would not be in the previous call to #children, but will be
> included in the next #children e.g.
>
> C>>children
>     ^ subComponents
>
> C>>render...
>     onClick: (html updater
>         ...
>         callback: [:r | subComponents add: C new.
>             self basicRenderOn: r ])
>
> Thanks - Sophie
>
>
>
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: #children and Ajax

Sophie424
In reply to this post by Lukas Renggli
"Lukas Renggli" <[hidden email]> wrote in message
>> I'm encountering some seemingly not-systematic "Children Not Found while
>> processing callbacks" that I don't understand.
>
> Related to backtracking?

Without backtracking, but after some Ajax callbacks, I am trying to reliably
reproduce it.

- Sophie



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: #children and Ajax

Sophie424
In reply to this post by Sebastian Sastre-2
Hi Sebastian,

>"Sebastian Sastre" <[hidden email]> wrote
> My solution was to make an #obseletes instVar where I collect the
> children components that are being obsoleted by this AJAX actions. So
> #children will allways answer the actual valid children components but
> also
> the obsoletes ones. The obsoletes are never rendered but in case of a
> backtrack they make all work as expected.

I would never have thought of that ... will remember this tip (though my
current problem seems to be something else).

> Again, as I said, I was not convinced to use AJAX that way at all
> until we have a full ajaxian backtrack solution.


Are you limiting your currently Ajax use then?

Thanks - Sophie



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: Re: #children and Ajax

Sebastian Sastre-2
> > Again, as I said, I was not convinced to use AJAX that way at all
> > until we have a full ajaxian backtrack solution.
>
>
> Are you limiting your currently Ajax use then?
>
> Thanks - Sophie
>
Yes, by now, I'm using AJAX only when backtrack has no mean so user can
trust the backbuton

Cheers,

Sebastian

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: #children and Ajax

Sophie424
In reply to this post by Sophie424

> Without backtracking, but after some Ajax callbacks, I am trying to
> reliably
> reproduce it.

I am getting this "Components not found ..." in the midst of pure Ajax
callbacks.
Seaside2.8a1-lr.533
Scriptaculous-lr.238

Is it considered safe to dynamically add components as below?

C>>children
    ^ subComponents

C>>render...
    onClick: (html updater
        ...
        callback: [:r | subComponents add: C new.
            self basicRenderOn: r ])

I might run through this N times successfully adding subcomponents, then on
the (N+1) time it dies. Below is the trace:

Many thanks - Sophie

========================================

Subject: [BUG]WARenderContinuation>>componentsNotFound:

VM: Win32 - a SmalltalkImage
Image: Squeak3.9 [latest update: #7067]

WARenderContinuation>>componentsNotFound:
 Receiver: a WARenderContinuation
 Arguments and temporary variables:
  aCollection:  an Array(a MPTreeView)
 Receiver's instance variables:
  root:  a WAToolFrame
  states:  a WASnapshot(a WAValueHolder contents: a MPPage->a WAValueHolder
conten...etc...
  context:  a WARenderingContext

WARenderContinuation>>unprocessedCallbacks:
 Receiver: a WARenderContinuation
 Arguments and temporary variables:
  aCollection:  an Array(a SUCallback)
  owners:  an Array(a MPTreeView)
  each:  a SUCallback
 Receiver's instance variables:
  root:  a WAToolFrame
  states:  a WASnapshot(a WAValueHolder contents: a MPPage->a WAValueHolder
conten...etc...
  context:  a WARenderingContext

WARenderContinuation>>processCallbacks:
 Receiver: a WARenderContinuation
 Arguments and temporary variables:
  aRequest:  a WARequest POST /map/repo2
  lastPosition:  0
  callbackStream:  a WACallbackStream
  each:  a WAToolFrame
 Receiver's instance variables:
  root:  a WAToolFrame
  states:  a WASnapshot(a WAValueHolder contents: a MPPage->a WAValueHolder
conten...etc...
  context:  a WARenderingContext

[] in WARenderContinuation>>handleRequest: {[self processCallbacks:
aRequest]}
 Arguments and temporary variables:
  aRequest:  a WARequest POST /map/repo2
  r:  nil


--- The full stack ---
WARenderContinuation>>componentsNotFound:
WARenderContinuation>>unprocessedCallbacks:
WARenderContinuation>>processCallbacks:
[] in WARenderContinuation>>handleRequest: {[self processCallbacks:
aRequest]}
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BlockContext>>on:do:
WARenderContinuation>>withNotificationHandler:
WARenderContinuation>>handleRequest:
WARenderContinuation(WASessionContinuation)>>value:
MPSession(WASession)>>performRequest:
[] in MPSession(WASession)>>responseForRequest: {[self performRequest:
aRequest]}
BlockContext>>on:do:
[] in MPSession(WASession)>>withErrorHandler: {[aBlock   on: Error   do: [:e
|     self errorHandler handleError: e.    WAP...]}
BlockContext>>on:do:
MPSession(WASession)>>withErrorHandler:
[] in MPSession(WASession)>>responseForRequest: {[self   withErrorHandler:
[self performRequest: aRequest]]}
BlockContext>>on:do:
WACurrentSession class(WADynamicVariable class)>>use:during:
[] in MPSession(WASession)>>responseForRequest: {[WACurrentSession   use:
self   during: [self     withErrorHandler: [self pe...]}
[] in MPSession(WASession)>>withEscapeContinuation: {[:cc |
escapeContinuation := cc.  aBlock value.  self pageIntentionallyLeft...]}
EscapeContinuation class(Continuation class)>>currentDo:
MPSession(WASession)>>withEscapeContinuation:
MPSession(WASession)>>responseForRequest:
[] in MPSession(WASession)>>incomingRequest: {[self responseForRequest:
aRequest]}
BlockContext>>on:do:
[] in WAProcessMonitor>>critical:ifError: {[value := aBlock on: Error do:
anErrorBlock]}
BlockContext>>ensure:
[] in WAProcessMonitor>>critical:ifError: {[[value := aBlock on: Error do:
anErrorBlock]   ensure: [semaphore signal]]}
[] in BlockContext>>newProcess {[self value.  Processor terminateActive]}



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: Re: #children and Ajax

Sebastian Sastre-2
And how your #basicRenderOn: works?

I do something similar without problems (add and remove dynamically
components N times. You allways add only? I ask because the remove is more
likely to bring that kind of trouble

        cheers,

Sebastian Sastre


 

> -----Mensaje original-----
> De: [hidden email]
> [mailto:[hidden email]] En nombre
> de itsme213
> Enviado el: Martes, 22 de Enero de 2008 11:34
> Para: [hidden email]
> Asunto: [Seaside] Re: #children and Ajax
>
>
> > Without backtracking, but after some Ajax callbacks, I am trying to
> > reliably reproduce it.
>
> I am getting this "Components not found ..." in the midst of
> pure Ajax callbacks.
> Seaside2.8a1-lr.533
> Scriptaculous-lr.238
>
> Is it considered safe to dynamically add components as below?
>
> C>>children
>     ^ subComponents
>
> C>>render...
>     onClick: (html updater
>         ...
>         callback: [:r | subComponents add: C new.
>             self basicRenderOn: r ])
>
> I might run through this N times successfully adding
> subcomponents, then on the (N+1) time it dies. Below is the trace:
>
> Many thanks - Sophie
>
> ========================================
>
> Subject: [BUG]WARenderContinuation>>componentsNotFound:
>
> VM: Win32 - a SmalltalkImage
> Image: Squeak3.9 [latest update: #7067]
>
> WARenderContinuation>>componentsNotFound:
>  Receiver: a WARenderContinuation
>  Arguments and temporary variables:
>   aCollection:  an Array(a MPTreeView)
>  Receiver's instance variables:
>   root:  a WAToolFrame
>   states:  a WASnapshot(a WAValueHolder contents: a MPPage->a
> WAValueHolder conten...etc...
>   context:  a WARenderingContext
>
> WARenderContinuation>>unprocessedCallbacks:
>  Receiver: a WARenderContinuation
>  Arguments and temporary variables:
>   aCollection:  an Array(a SUCallback)
>   owners:  an Array(a MPTreeView)
>   each:  a SUCallback
>  Receiver's instance variables:
>   root:  a WAToolFrame
>   states:  a WASnapshot(a WAValueHolder contents: a MPPage->a
> WAValueHolder conten...etc...
>   context:  a WARenderingContext
>
> WARenderContinuation>>processCallbacks:
>  Receiver: a WARenderContinuation
>  Arguments and temporary variables:
>   aRequest:  a WARequest POST /map/repo2
>   lastPosition:  0
>   callbackStream:  a WACallbackStream
>   each:  a WAToolFrame
>  Receiver's instance variables:
>   root:  a WAToolFrame
>   states:  a WASnapshot(a WAValueHolder contents: a MPPage->a
> WAValueHolder conten...etc...
>   context:  a WARenderingContext
>
> [] in WARenderContinuation>>handleRequest: {[self processCallbacks:
> aRequest]}
>  Arguments and temporary variables:
>   aRequest:  a WARequest POST /map/repo2
>   r:  nil
>
>
> --- The full stack ---
> WARenderContinuation>>componentsNotFound:
> WARenderContinuation>>unprocessedCallbacks:
> WARenderContinuation>>processCallbacks:
> [] in WARenderContinuation>>handleRequest: {[self processCallbacks:
> aRequest]}
>  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> BlockContext>>on:do:
> WARenderContinuation>>withNotificationHandler:
> WARenderContinuation>>handleRequest:
> WARenderContinuation(WASessionContinuation)>>value:
> MPSession(WASession)>>performRequest:
> [] in MPSession(WASession)>>responseForRequest: {[self
> performRequest:
> aRequest]}
> BlockContext>>on:do:
> [] in MPSession(WASession)>>withErrorHandler: {[aBlock   on:
> Error   do: [:e
> |     self errorHandler handleError: e.    WAP...]}
> BlockContext>>on:do:
> MPSession(WASession)>>withErrorHandler:
> [] in MPSession(WASession)>>responseForRequest: {[self  
> withErrorHandler:
> [self performRequest: aRequest]]}
> BlockContext>>on:do:
> WACurrentSession class(WADynamicVariable class)>>use:during:
> [] in MPSession(WASession)>>responseForRequest:
> {[WACurrentSession   use:
> self   during: [self     withErrorHandler: [self pe...]}
> [] in MPSession(WASession)>>withEscapeContinuation: {[:cc |
> escapeContinuation := cc.  aBlock value.  self
> pageIntentionallyLeft...]} EscapeContinuation
> class(Continuation class)>>currentDo:
> MPSession(WASession)>>withEscapeContinuation:
> MPSession(WASession)>>responseForRequest:
> [] in MPSession(WASession)>>incomingRequest: {[self
> responseForRequest:
> aRequest]}
> BlockContext>>on:do:
> [] in WAProcessMonitor>>critical:ifError: {[value := aBlock
> on: Error do:
> anErrorBlock]}
> BlockContext>>ensure:
> [] in WAProcessMonitor>>critical:ifError: {[[value := aBlock
> on: Error do:
> anErrorBlock]   ensure: [semaphore signal]]}
> [] in BlockContext>>newProcess {[self value.  Processor
> terminateActive]}
>
>
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: #children and Ajax

Sophie424
"Sebastian Sastre" <[hidden email]> wrote
> And how your #basicRenderOn: works?

Most of my #renderContentOn: look something like this to enable replacement:

C>>renderContentOn: html
    | id |
    html div
        id: (id := html nextId);
        with: [self basicRenderOn: html optionallyWithId: id]

C>>basicRenderOn: html
    ...
    children do: [:each | html render each]

> I do something similar without problems (add and remove dynamically
> components N times.

That's good to know. It means I am more likely doing something incorrectly.

> You allways add only? I ask because the remove is more
> likely to bring that kind of trouble

I do both adds and removes. The failure occurs in a sequence of just adds;
perhaps an earlier remove may be causing it?

Thanks,

Sophie




_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: Re: Re: #children and Ajax

Sebastian Sastre-2
> C>>renderContentOn: html
>     | id |
>     html div
>         id: (id := html nextId);
>         with: [self basicRenderOn: html optionallyWithId: id]
>

I'm doing more or less the same.

> C>>basicRenderOn: html
>     ...
>     children do: [:each | html render each]
>
Massive children render. Caution should be taken in that collection
maintenance no to render any obsolete or removed children.

> > I do something similar without problems (add and remove dynamically
> > components N times.
>
> That's good to know. It means I am more likely doing
> something incorrectly.
>
> > You allways add only? I ask because the remove is more
> likely to bring
> > that kind of trouble
>
> I do both adds and removes. The failure occurs in a sequence
> of just adds; perhaps an earlier remove may be causing it?
>
If you do not maintain carefully children components then the chance of
having that problem is greater but I've asked you because you are the chosen
one to answer that question :) Use ST tools to diagnose things. I use self
assert: in the middle of some code to cach inconsistencies sometimes. Use
anything that could help you get near the answer. Sometimes you don't find
the answer directly but doing things that leads you to a serendipity. So go
do things that favors "serendipitation".

        Cheers,

Sebastian

> Thanks,
>
> Sophie
>
>
>
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: #children and Ajax

Sophie424
"Sebastian Sastre" <[hidden email]> wrote
>>     children do: [:each | html render each]
>>
> Massive children render.

Apologies, careless typing on my part ... I do
    subViews do: [:each | html render each]

> If you do not maintain carefully children components then the chance of
> having that problem is greater but I've asked you because you are the
> chosen
> one to answer that question :) Use ST tools to diagnose things. I use self
> assert: in the middle of some code to cach inconsistencies sometimes. Use
> anything that could help you get near the answer. Sometimes you don't find
> the answer directly but doing things that leads you to a serendipity. So
> go
> do things that favors "serendipitation".

Thanks for the tips!

Sophie



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside