livereload: Disconnect from websocket server on pageswap

Fixes #14983
This commit is contained in:
Bjørn Erik Pedersen
2026-06-02 21:57:27 +02:00
parent 0f440460c8
commit 79be0532f1
2 changed files with 16 additions and 6 deletions
+10
View File
@@ -32,3 +32,13 @@ HugoReload.prototype.reload = function (path, options) {
};
LiveReload.addPlugin(HugoReload);
// Disconnect LiveReload before the page is captured for a cross-document view
// transition. With Speculation Rules prerendering in Chromium, an active
// LiveReload WebSocket on the outgoing page causes a flash during the
// transition. LiveReload reconnects automatically on the next page load.
addEventListener('pageswap', function () {
if (window.LiveReload) {
window.LiveReload.shutDown();
}
});
+6 -6
View File
File diff suppressed because one or more lines are too long