[Seaside] Re-render component on back button

Bob Arning arning315 at comcast.net
Mon Dec 2 13:47:41 UTC 2013


I did a little poking around with WACounter (early seaside version 3) and..

When hitting the back button(Chrome), the screen updates correctly, but 
does not re-render, suggesting caching. So I requested no-caching:

renderContentOn: html

*self requestContext response doNotCache.**
**    html heading: Time now asString.*
     html heading: count.
     html anchor
         callback: [ self increase ];
         with: '++'.
     html space.
     html anchor
         callback: [ self decrease ];
         with: '--'.

And still no re-render. Google found this:

http://blog.55minutes.com/2011/10/how-to-defeat-the-browser-back-button-cache/

Changing:

WAResponse>>doNotCache
     "Configure the receiver to not be cached at all."

     self headerAt: 'Pragma' put: 'no-cache'. "Proxies"
     self headerAt: 'Expires' putDate: self doNotCacheExpiryDate. "HTTP 1.0"
     self headerAt: *'Cache-Control' put: 'no-cache, max-age=0, 
must-revalidate, no-store'*. "HTTP 1.1"

and now it re-renders on a back button. HTH

Cheers,
Bob

On 12/1/13 10:34 AM, 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
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20131202/993485b3/attachment.htm


More information about the seaside mailing list