How is history back handled internally? #405
Replies: 2 comments 1 reply
-
|
By default Unpoly will render the
While the response for the previous page may be cached, all DOM elements are re-created from the reponse's HTML body. |
Beta Was this translation helpful? Give feedback.
-
Yes. Since the repaint is done in single frame you won't see flickering either way. This is really an optimization to update fewer elements or to preserve elements with local state (e.g. a chat box in the application layout). |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm discovering unpoly, which looks great! Out of curiosity, how is "history back" handled? (if you can give the big picture story @triskweline)
When rendering a page
index.htmlfor the first time, how does it know how it should be rendered again after a navigation and a history back /onpopstate?How does Unpoly know which "fragment" will be used when going back to
index.html: should everything be rendered? Or only<div class="content">, or something else? What tells which part should be restored, and which part shouldn't (to avoid reload everything / page flickering) which doing "history back"?Also, does unpoly save/back up the DOM state in localStorage (or similar) for every page of the navigation, so that it can be restored later? (I think HTMX does this, but I need to check)
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions