[Seaside] children & egg problem

radoslav hodnicak rh at 4096.sk
Wed Sep 8 04:19:47 CEST 2004


On Mon, 30 Aug 2004, Avi Bryant wrote:

> > In 2.5, the complete root component with its children must be ready
> > before
> > authentication decoration kicks in - but I can't initialize my
> > (non-root)
> > components before I know who is logged in. In 2.3 this was not a
> > problem
> > because there was no #children. Suggestions?
>
> If nobody's logged in, just return #() from #children, because you know
> nothing will be rendered anyway due to the auth decoration.

I did that and noticed a weird thing. Imagine a root component with two
columns, navigation left and "main" right (just like the old squeakmap
browser example). Navigation causes #call:s in the main component. The
main is #render:ed hence it should be in children(*).

So when I return main in my children at all times, clicking navigation and
going back in browser works ok.

But when I return empty array before login, following happens.
- app start up, i log in
- get normal navigation/main
- click navigation, another component gets called on main
- i click back button (if not in IE you may have to hit refresh)
- i don't get the original-fresh-after-login screen but the called
component stays displayed there

I think this is the same kind of problem like in #isolate: I wrote about
earlier, for some reason the wrong state is captured/restored.

rado

(*) I'm not completely clear about this - are children supposed to be a
collection of all subcomponents that *may* show up, or a collection of
exactly those subcomponents that are displayed. In other words, if I have
conditional #renderContentOn: that renders or renders not various
subcomponents, do I need conditional #children too? Or can I just stuff
there all that could possibly be rendered



More information about the Seaside mailing list