[Seaside] Component lifecycle and how to use announcement on a model

Sean Allen sean at monkeysnatchbanana.com
Mon Aug 16 16:29:25 UTC 2010


I haven't used announcements so I can't answer your question, but I
remember Dave Woodward did blog about about that no so long ago,
he might be able to help. He is on twitter as futuremint. I can't find
the blog post though. Maybe I imagined it, but I don't think so.

On Wed, Aug 11, 2010 at 6:23 PM, Tim Mackinnon <tamackinnon at gmail.com> wrote:
> Hi guys - as I drill through my "once simple" toy application (actually its
> not that bad - particularly compared to the java/gwt stuff I get at work) -
> I keep coming up with features that excercise new parts of seaside/pharo.
> I currently have a "model" that I store as a class variable on my root
> component. As i've split out bits of functionality from my app and moved
> them into sub-components, I've instantiated those components with that same
> shared model so they could render different parts of it. I think this is the
> right style...?
> Anyway in adding a new "Remove button" feature, it felt like it should live
> in an existing items list component - however a model update can require an
> ajax update to redraw my model state so everything looks right (and its my
> main component that coordinates this).
> So it seemed like a perfect fit for Announecments - my root could subscribe
> to a model change and then coordinate the ajax update of the correct
> components.
> I did this , and then started getting updates all over the place (even
> unexpectedly) - I'm thinking that when I subscribe to my Announcements, I
> shouldn't do this in the #initialize of my root component? I think I must
> get a new initialize every time I refresh the page - and so register another
> notification?
> So I'm wondering what the lifecycle of a WAComponent is? And where/how I
> should initialize a singleton model? I've read the bits about session's -
> but in my case I want multiple browsers to share the same model (so each
> would be in its own session - so I don't think I want to go that route?).
> Do I lazy initialize the subscription along with the singleton model (or is
> there a better way)? And when do I unsubscribe? I think I'm missing the info
> about the component lifecycle - where should I look to understand/read about
> that?
> Tim
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

More information about the seaside mailing list