[Seaside] trouble with callbacks

Julian Fitzell julian at beta4.com
Mon Aug 1 21:48:17 CEST 2005


Yes, lazy initialization can cause problems because of when the 
snapshots are taken and rolled back.  You may find your component rolled 
back to a point before the variable was initialized again.

But more important is the fact that you are using #call: from within 
your render method which is a no-no.  You will often see #call: inside a 
render method but it should always be within a callback block which 
won't actually be executed until the next execution phase.  Once we have 
begun rendering, the component tree has been determined and calling out 
to another component causes problems.

It seems like what you want here is a task.  Create a subclass of WATask 
and add a #go method.  In the #go method, you can have conditional 
application logic and calls out to several other components to do work 
for you (the final one being, presumably, a call to your batched list 
component).  Seems like that should be closer to what you are trying to 
achieve...

Julian

Ramon Leon wrote:
> I have a feeling that your renderContentOn is somehow changing state,
> that call to the criteriaComponent at the top concerns me, seems that if
> you're building up the list each time, that you can't page next because
> each render builds up a whole new list of items, destroying the last
> list that was rendered.
> 
> 
>>-----Original Message-----
>>From: seaside-bounces at lists.squeakfoundation.org 
>>[mailto:seaside-bounces at lists.squeakfoundation.org] On Behalf 
>>Of Jason Rogers
>>Sent: Monday, August 01, 2005 11:59 AM
>>To: The Squeak Enterprise Aubergines Server - general discussion.
>>Subject: Re: [Seaside] trouble with callbacks
>>
>>On 7/29/05, Ramon Leon <rleon at insario.com> wrote:
>>
>>>Show code.
>>
>>renderMyContentOn: html 
>>	| itemView |
>>	viewFilter := self getViewFilterFor:  (self call: self 
>>criteriaComponent)
>>	itemView := self viewFilter view.
>>	itemView isEmptyOrNil 
>>		ifTrue: 
>>			[html divClass: #content with: [html 
>>text: 'None']]
>>		ifFalse: 
>>			[bacthedListTableComponent 
>>tableHeaders: (self gatherHeadersFrom: itemView).
>>			[bacthedListTableComponent data: itemView.
>>			html render: [bacthedListTableComponent].
>>
>>criteriaComponent
>>	"answer a ShoreComponent that will be used to set my 
>>searchCriteria"
>>	criteriaComponent
>>		ifNil: [criteriaComponent := self 
>>criteriaComponentClass parent: self;
>>						 label: self filterName;
>>						 yourself].
>>	^ criteriaComponent
>>
>>
>>--
>>Jason Rogers
>>
>>"I am crucified with Christ: nevertheless I live; yet not I, 
>>but Christ liveth in me: and the life which I now live in the 
>>flesh I live by the faith of the Son of God, who loved me, 
>>and gave himself for me."
>>    Galatians 2:20
>>_______________________________________________
>>Seaside mailing list
>>Seaside at lists.squeakfoundation.org
>>http://lists.squeakfoundation.org/listinfo/seaside
>>
> 
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/listinfo/seaside

-- 
   Julian Fitzell  --  Beta4 Productions
julian at beta4.com  --  http://www.beta4.com
Seaside: http://seaside.st/


More information about the Seaside mailing list