[Seaside] State shared between components

Holger Kleinsorgen h.kleinsorgen at i-views.de
Sun Mar 30 14:05:26 UTC 2008


Hello,

while implementing #states for some components, I encountered an oddity, 
and I'm not sure if me or Seaside is missing something. Some components 
share a common object containing context information (roughly comparable 
with the Refactoring Browser's navigator state). And since the 
components don't know of each other, they happily include the context 
object when asked for #states.

However, #register: is implemented the following way:

   WASnapshot>>register: anObject
     anObject ifNotNil: [ self at: anObject put: anObject snapshotCopy ]

so the snapshot machinery will overwrite the previous snapshot of the 
shared context again and again.

Since the application contains a lot of components, and the context 
object is a bit heavy, I've tweaked #register: the following way:

   WASnapshot>>register: anObject
      anObject notNil ifTrue: [
         self at: anObject ifAbsentPut: [ anObject snapshotCopy ]
     ].

is this a valid patch? Or will I run into troubles somewhere else?


More information about the seaside mailing list