[Seaside] #call without #answer
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:
- BodyComponent - one of BodyOne | BodyTwo | etc components.
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 ,,, 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
^ Array with: theDisplayComponent
theDisplayComponent := self randomDisplayComponent.
^ TestMultipleShowsComponent value: 1000 atRandom.
html div: [html render: theDisplayComponent].
html anchor callback: [theDisplayComponent show: self
randomDisplayComponent]; with: 'another component'
WAComponent subclass: #TestMultipleShowsComponent
html div: value.
html anchor callback: [self answer: true]; with: 'answer'.! !
value := aValue! !
#TestMultipleShowsComponent class>>value: aValue
^ self new value: aValue.
More information about the seaside