[Seaside] WAComponent callbacks, continuations and #children

Lukas Renggli renggli at gmail.com
Thu Jun 7 20:34:26 UTC 2007

> !BrokenExample methodsFor: 'as yet unclassified' stamp: 'JMT 6/7/2007 14:33'!
> initialize
>         menu _ MenuContainer new root: self.
>         registry _ (Dictionary new
>                 at: 'content' put: (ContentContainer new root: self);
>                 yourself)! !

1. Always call super initialize. I know this works in 2.7, but it
breaks in 2.8.

2. Register all the objects that reference components that are
returned as children for backtracking.

This means you need to add the following two lines to the end of your
initialize method in 2.7:

    self session
        registerObjectForBacktracking: registry;    " for the dictionary "
        registerObjectForBacktracking: self           " for the menu "

In 2.8 this is simpler, you implement the message #states to answer
the objects to be backtracked:

        ^ Array with: registry with: self

3. Thanks to your question I found another severe bug in the
backtracking of dictionaries (there was a long undiscovered one in
Set, but obviously this was not the end). This is fixed and tested
against in 2.8. For 2.7 make sure that you have these two methods:

        ^ self copy

    Dictionary>>restoreFromSnapshot: aDictionary
        self keys do: [ :key | self removeKey: key ].
        aDictionary keysAndValuesDo: [ :key :value | self at: key put: value ]

Considering all this makes your example work.

Thanks for providing the example that lead to a solution to this bug.


Lukas Renggli

More information about the Seaside mailing list