1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-16 18:01:37 +00:00

feat(js): force page reload to prevent stale data from bfcache

The unread page may show outdated entries when navigating back from an article, due to Chrome's back/forward cache (bfcache) restoring the page from memory.

Reference: https://web.dev/articles/bfcache
This commit is contained in:
Frédéric Guillot 2025-08-07 19:18:25 -07:00
parent 6532435db9
commit f7e672452b
2 changed files with 11 additions and 1 deletions

View file

@ -1268,3 +1268,10 @@ initializeKeyboardShortcuts();
initializeTouchHandler();
initializeClickHandlers();
initializeServiceWorker();
// Reload the page if it was restored from the back-forward cache and mark entries as read is enabled.
window.addEventListener("pageshow", (event) => {
if (event.persisted && document.body.dataset.markAsReadOnView === "true") {
location.reload();
}
});