[Seaside] Garbage Collection/Handling

John Thornborrow john at pinesoft.co.uk
Fri Apr 13 13:00:04 UTC 2007

Lukas Renggli wrote:
>> Rootcomponent>>children
>>     ^Array with: SomeComponent new.
>> Rootcomponent>>renderContentOn: html
>>     html render: SomeComponent new.
> That wont work due to different reasons:
> - The object you return from children is not the same object that you
> render in #renderContentOn:
> - With every request you create a new instance of SomeComponent and
> loose all the existing state. You should never need to initialize
> components in rendering code.
>> Now, that is a *very* simple example - but it does demonstrate what I am
>> referring to - there are now two instances of SomeComponent, when only
>> one is needed. This will be resolved by a lazy loader, but for more
>> complex examples it is not easy.
> This is standard:
> Rootcomponent>>initialize
>     super initialize.
>     some := SomeComponent new.
> Rootcomponent>>children
>     ^Array with: some
> Rootcomponent>>renderContentOn: html
>     html render: some
>> I am still learning with Seaside, but so far I can see that the
>> #children are then processed with #childrenDo: but I still ask "Why?"
>> Why must they have this processing here, and not at rendering?
> Because Seaside is stateful. It needs the children information to
> process callbacks, to render the <head>, to enable REST-ful URLs and
> probably other things ...
> Lukas
I did suspect this, and thank you for the info.

However, for one component I have two child components - and upon any
request, only one of those components will be rendered.
So I have similar to this:

    super initialize.
    componentOne _ ComponentOne new.
    componentTwo _ ComponentTwo new.

    ^{componentOne. componentTwo}

Root>>renderContentOn: html
       ifTrue: [html render: componentOne]
       ifFalse: [html render: componentTwo]

Both components have an effect on the html root object (both over ride
#updateRoot:) and have differing values. So far "it's working" but I am
not sure if this is an acceptable process for it? Does the html root
object make changes to the root attributes (or other items) according to
both components, regardless of which component is rendered?

Many thanks,

Pinesoft Computers are registered in England, Registered number: 2914825. Registered office: 266-268 High Street, Waltham Cross, Herts, EN8 7EA

This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com

More information about the Seaside mailing list