css reload fix I hope

This commit is contained in:
N0\A
2025-10-30 08:54:00 +01:00
parent 9a0fb86d80
commit e2fddaf8e3

View File

@@ -1,10 +1,19 @@
(function () { (function () {
const SSE_PORT = 8765; const SSE_PORT = 8765;
const RECONNECT_DELAY = 5000; // miliseconds const RECONNECT_DELAY = 5000; // milliseconds
let eventSource = null; let eventSource = null;
let reconnectTimer = null; let reconnectTimer = null;
function reloadStylesheets() {
// Force reload all stylesheets
const links = document.querySelectorAll('link[rel="stylesheet"]');
links.forEach(link => {
const href = link.href.split('?')[0];
link.href = href + '?t=' + new Date().getTime();
});
}
function connect() { function connect() {
if (reconnectTimer) { if (reconnectTimer) {
clearTimeout(reconnectTimer); clearTimeout(reconnectTimer);
@@ -23,8 +32,14 @@
const data = JSON.parse(event.data); const data = JSON.parse(event.data);
if (data.type === "reload") { if (data.type === "reload") {
console.log("Repository updated, reloading page..."); console.log("Repository updated, reloading page...");
// Hard reload to bypass cache
// First reload stylesheets
reloadStylesheets();
// Then hard reload the page after a brief delay
setTimeout(() => {
window.location.reload(true); window.location.reload(true);
}, 100);
} }
} catch (e) { } catch (e) {
console.error("Error parsing SSE message:", e); console.error("Error parsing SSE message:", e);