[Seaside] WAComponent instances tree + proper page refreshing for user (back button) - confusion

Johan Brichau johan at inceptive.be
Tue Jan 16 08:02:57 UTC 2018

Hi Petr,

Good questions.
The problem you are describing is about concurrent changes to the datamodel and how you can keep the Seaside component state of concurrent sessions in sync.

First off, Seaside backtracking support is mostly intended for UI state and not model state.
Inevitably, the two are connected, as illustrated in your example of a list of items in a db where each data record corresponds to a UI component.

You can make changes to the component state in the action phase of a callback (e.g. in the callback attached to an anchor), however there is no way to refresh the state when the user uses the back button and deal with concurrent changes to the state. 

An interesting similar discussion that proposes a way to avoid browser caching when the back button is used is described here: [1].

Next, I think there are a couple of options:

- Make sure the Seaside component state cannot be affected by concurrent changes. This means that you would not use separate components per record in your list. Instead, an entire list would be encapsulated in a single component and its rendering code directly uses the state of the data model rather than state stored in the UI.

- Fiddle around with the continuation restore code in WASnapshot and create separate WARenderPhaseContinuation classes for use in your application that restore the session state _and_ verify its consistency with the datamodel. You can do this cleanly as Seaside provides support to use your own continuation classes and thereby customize what needs to happen when restoring the session state. If you use the method to prevent caching described in [1], you can probably make something interesting with that.

This last option is an interesting one, but I don’t really have the time to dive into it to give it a try (though my fingers are iching ;)

[1] http://forum.world.st/Re-render-component-on-back-button-td4726578.html <http://forum.world.st/Re-render-component-on-back-button-td4726578.html>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/seaside/attachments/20180116/9b599e47/attachment.html>

More information about the seaside mailing list