[Seaside] updating children components
Avi Bryant
avi at beta4.com
Tue Jun 1 09:35:52 CEST 2004
On May 31, 2004, at 11:51 PM, Romain Robbes wrote:
> Hi Avi,
>
> Thanks for your answer. Is the requirement for #children to return the
> same
> value applicable only across each call to #render in WARenderLoop ?
> If so, I might as a temporary hack add a first traversal to tell my
> components
> to <<freeze>> during rendering.
Well, that's accurate, but it's trickier than it seems because #render
has a continuation capture in the middle of it. A better way of
stating the requirement is this:
When #children is called immediately while processing a set of
callbacks, it should return the same set of subcomponents that were
rendered when those same callbacks were initially registered, taking
into account that StateHolders and other backtracked objects will have
rolled back their state appropriately.
So there's actually not a continuous span of chronological time within
which you can freeze updates to the components: especially given the
use of the back button, an arbitrary amount of time might have passed
between the HTML response during which the callbacks were registered,
and the corresponding request where they are processed, and other
response/request pairs may have happened in the meantime.
Given that, here's something that might work for you:
- make sure all of your child state is backtrackable, eg, by using
StateHolders to hold onto your subcomponent instances or collections of
them (in which latter case, only use immutable collections).
- freeze updates during the request processing phase, ie, the last two
lines of WARenderLoop>>render:
root decorationChainDo: [:ea | ea processRequestInputs: request
context: context].
root decorationChainDo: [:ea | ea processRequestActions: request
context: context]
There's still a faint possibility that an update could occur in the
instant between the StateRegistry snapshot being restored and the
freeze beginning, but given Squeak's concurrency model I think it's
unlikely to happen.
Avi
More information about the Seaside
mailing list