[Seaside] expiring pages

Avi Bryant avi at beta4.com
Thu Jul 22 20:55:52 CEST 2004


On Jul 22, 2004, at 8:36 AM, radoslav hodnicak wrote:

> ViewerComponent
>  item1
>  item2
>
> click on item1 => session isolate: [self call: (EditComponent on: 
> item1)]
>
> EditComponent on item1
>  edit form 1 => edit form 2 => ... => final form with save/cancel
>
> now, user gets to form 2, the properties from form 1 are already 
> changed
> in item1. user uses back button to get to Viewer page and starts to 
> edit
> item2. I'm stuck with half-changed item1.
>
> Is there a way to do something so that the old isolate block gets
> completed/cancelled/whatever and I can rollback a transaction there?

The problem is that in the general case you don't know whether they 
used the back button (and thus no longer have access to form2, and so 
you'd want to roll item1 back), or whether they have two browser 
windows open, in which case it would be perfectly valid for them to be 
editing both item1 and item2 at once.  If you assumed that they weren't 
going to do that, you could hack in a notion of "current model" - 
whenever you go to a new component, do something like

self session currentModel: anItem

where #currentModel: checks to see if the model has changed, and it if 
has, it:
	- snapshots the new model
	- rolls back the old model to the old snapshot
	- stores the new model and new snapshot

When you hit the final form and the user hits save, you can send 
something like #clearModel which will nil out the model and snapshot so 
it doesn't get rolled back in the future.

However, I personally prefer to allow the user to use as many browser 
windows as they want to.  The only real solution here is what Julian 
suggested - don't operate on the real model object, but on a working 
copy of it, and then copy that back into the real object when the user 
hits save (rollforward?).  This is where a proper in-image 
transactional system would be really nice, as we've discussed before.

Avi



More information about the Seaside mailing list