[Seaside] #call without #answer

Nick Ager nick.ager at gmail.com
Thu Dec 17 17:21:00 UTC 2009


I have an application that has a body section, where the body section
might be one of many components.For example:

    - HeaderComponent
    - BodyComponent - one of BodyOne | BodyTwo | etc components.
    - FooterComponent

The question is whether to use #call:/#show: to change the
BodyComponent *or* use Announcements to set a different component in
TemplateComponent which then subsequently rendered in place of the
This question has been raised a few times before [1],[2],[3], however
the answers given didn't help me understand what happens when a
component uses #call:/#show: without the corresponding #answer:. My
concern is that the stack of AnswerHandlers/Delegates increases for
each #show/#call without the corresponding #answer. I built a simple
app to try to understand what's going and it appears that the stack
grows for each #show/#call. I click on  'another component' anchor and
as expected the #show: method results in a new component being
displayed. Clicking 'another component' repeatedly and then
subsequently clicking on the  'answer' anchor results in the previous
component being revealed all the way back to the starting component.
My conclusion is that it's *bad* to use #call:/#show: without the
corresponding #answer: as a AnswerHandlers/Delegates list is
increasing without items being removed. OR have I missed something?




WAComponent subclass: #TestMultipleShows
	instanceVariableNames: 'theDisplayComponent'

	^ Array with: theDisplayComponent

	super initialize.
	theDisplayComponent := self randomDisplayComponent.

	^ TestMultipleShowsComponent value: 1000 atRandom.

renderContentOn: html
	html div: [html render: theDisplayComponent].
	html anchor callback: [theDisplayComponent show: self
randomDisplayComponent]; with: 'another component'

WAComponent subclass: #TestMultipleShowsComponent
	instanceVariableNames: 'value'

renderContentOn: html
	html div: value.
	html anchor callback: [self answer: true]; with: 'answer'.! !

value: aValue
	value := aValue! !

#TestMultipleShowsComponent class>>value: aValue
	^ self new value: aValue.

[1] http://lists.squeakfoundation.org/pipermail/seaside/2008-April/017575.html
[2] http://lists.squeakfoundation.org/pipermail/seaside/2007-January/010298.html
[3] http://lists.squeakfoundation.org/pipermail/seaside/2003-September/002142.html

More information about the seaside mailing list