[Seaside] updating children components

Avi Bryant avi at beta4.com
Fri May 28 23:05:06 CEST 2004


On May 28, 2004, at 1:25 AM, Romain Robbes wrote:

> In fact we have trees of domain objects that can be seen by several 
> users at the
> same time, and we want to manage udpating using an observer pattern, 
> as the
> tree's shape can change (and therefore the component tree too). So we 
> want the
> children to change only after each rendering pass.

That's an interesting problem.  I'm not sure exactly how to best 
address it.  I would definitely recommend using a pull model rather 
than push - your #children method should build its results dynamically 
from the current state of the domain objects, rather than the domain 
objects directly modifying the component tree, since if you don't have 
any synchronization around that you could definitely get into trouble.  
But even so, you're right that there are no hard guarantees that 
#children will return the same collection over multiple calls, and in 
some cases this could lead to odd behavior.

In practice, I suspect you won't see many problems of this sort, but of 
course when you do they'll be especially annoying because they'll be 
intermittent and hard to reproduce.

I'll think about how to make this more robust - ie, how to best cache 
the value of #children across periods of time where it's supposed to 
stay the same.

Thanks for bringing this up.

Avi



More information about the Seaside mailing list