[Seaside] supressing rendering

Avi Bryant avi at beta4.com
Wed Sep 15 23:46:22 CEST 2004


On Sep 13, 2004, at 10:45 PM, radoslav hodnicak wrote:

> I have this piece of code that reads parameters from url and 
> initializes
> the application to some state where it should behave the same way as if
> the user did all the clicking.
>
> In my (WA)Main class I have
>
> [self root main call: SomeViewer new]
>  on: WARenderNotification
>  do: [:n| self root main activeComponent callEditorWith: someURLData].
>

> It works (displays the correct page), however when I return (answer:) 
> from
> the editor call, any link on subcomponents on the new page causes
> 'Components not found while processing callbacks:' error.

You do like to make things complicated, hey...

It would hurt my head to think through this fully, but I'm sure it has 
something to do with the fact that you're not in the context of a 
RenderLoop (do you, in fact, start a RenderLoop at all during this 
process?).  At any rate, even if you set things up properly at the end, 
all the continuations that were captured during earlier #call:s will be 
in the wrong dynamic context, so answering is going to be a mess.

This is actually a very similar problem to that of making WATask work, 
since it needs to essentially supress the render and automate the click 
of its implicit #go link.  It seems silly, but by far the best way I 
found to implement that was with redirects - so when you #call: a Task 
you actually get an extra redirect there as it registers its #go 
callback and then renders a 302 which immediately invokes it.  I wonder 
if you could do the same thing here?  For example, you could write a 
WARedirectDecoration:

WARedirectDecoration>>callback: aBlock
	callback := aBlock

WARedirectDecoration>>renderContentOn: html
	self remove.  "we only want to do this once"
	self session redirectTo: (html urlForAction: callback)

Then your code would look like this:

self call:
	(SomeView new
		addDecoration: (WARedirectDecoration new
						callback: [self root main activeComponent callEditorWith: 
someURLData]);
		yourself)

That work?

Avi



More information about the Seaside mailing list