[Seaside] Re-render component on back button

Diego Lont diego.lont at delware.nl
Mon Dec 2 08:33:04 UTC 2013


Hi Lorenz,

I am not sure what you are asking, so I will give you 2 answers:

Answer 1) Session state.
Seaside has tools for rendering the same page or a different page on a back button. There is the so-called "session" state. This state depends on where you are. Depending on how you implement children and states, components are part of this session state. So if you store your shopping cart in your session state, then going back, would also roll back the shopping cart. If you want it to persist, then you have to store it somewhere else. For instance, you could make a shopping cart cache belonging to the user. And if it is a guest user, than you make some temp user, that is removed after a certain time.

Answer 2) Browser cache.
Caching is possible on the browser side, and on proxy servers. In the header information you can supply information wether a browser or proxy is supposed to cache a page, and for how long, or if they are supposed to reload a page always. I believe the default is that it is not specified in seaside, and thus browser dependent. You have to look up how to set this, but it should not be too hard. Also in production you probably have a web server between your seaside and the net, and I usually configure it here.

Diego

On Dec 1, 2013, at 4:34 PM, Lorenz Köhl wrote:

> I'm developing a shopping cart and wondering if there's any way to show its size consistently even after pressing the back button.
> 
> I think I would need to force a re-render, but since I'm not sure what the browsers actually request on back button presses I'm at a loss how to configure this, if possible.
> 
> When I open the developer tools network tab in chrome and press the back button, the behaviour is different than normally, ie. after I added an item and it shows '1 article' and I press back, then the component is properly re-rendered and still shows '1 article' even on the previous page. So chrome requests are probably
> different..
> 
> Is it possible to force this behaviour in the normal browser state?
> 
> greetings,
> 	Lo_______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



More information about the seaside mailing list