[Seaside] Un-calling components

Patrick Collison patrick at collison.ie
Wed Aug 22 06:49:40 UTC 2007

In our application, we have sidebar and main content components that
are rendered side-by-side. A kinda awkward issue arises when the main
component #call's another -- if the user selects a link in the
sidebar, any changes the sidebar makes to the view state of the main
component aren't seen by the user (the main component is still
decorated, and so the #call'ed component is rendered).

To solve it, we added a decoration to the sidebar component, with the
following method:

processChildCallbacks: aStream
	"If the user clicks on a link in the sidebar, un-#call the main
content component if it has been #call'ed"
	(aStream callbacks contents anySatisfy: [:callback |
		(aStream request fields includesKey: callback key)
			and: [callback owner = self owner]])
		ifTrue: [
			| dec |
			dec := self owner parent decoration.
			dec isDecoration ifTrue: [dec remove]].
	^ super processChildCallbacks: aStream

We also had to add #callbacks and #request methods to
WACallbackStream. (Note that we don't want the callee to #answer: --
we just ignore the fact that it was ever called in the first place.)

I'm curious as to whether there's a better way of doing what we're
trying to accomplish? Or has anyone else ever needed something along
these lines?

More information about the seaside mailing list