unpoly · GitHub

@triskweline First of all, thanks for all the hard work that you and your team puts into sharing Unpoly.

Second, this new behaviour is very problematic in my case:
"After rendering stale content from the cache, Unpoly now automatically renders a second time with fresh content from the server."

I have a cart page which now first displays stale content and after the HXR request it gets updated but this is huge issue I think, because what if the XHR update takes seconds, for example? Even with a 200-300 ms waiting time it is rather strange to see stale Cart Items come and go (depending on if the item was added or removed from the cart).

Note that I use POST request to change the cart so this should apply:
"When the user makes a non-GET request (usually a form submission with POST), the entire cache is expired."

Sending X-Up-Evict-Cache: /cart/* from the server partially solves the issue, because in the case of deleting an item from the cart and revisiting the cart again no stale content is shown with this header sent. But it does not solve the action of adding an item when the user sees it being added to the cart only after the XHR request succeeds.

What can be done to see fresh content right away all the time (no matter what) for a give page? Am I missing something perhaps?

Read the original on github.com ↗