fix: various infinite timeline issues

This commit is contained in:
trisua 2025-06-26 13:41:08 -04:00
parent aeaa230162
commit 87b61d7717

View file

@ -288,7 +288,7 @@ media_theme_pref();
const goals = [150, 250, 500, 1000]; const goals = [150, 250, 500, 1000];
track_element.setAttribute("data-scroll", "0"); track_element.setAttribute("data-scroll", "0");
scroll_element.addEventListener("scroll", (e) => { scroll_element.addEventListener("scroll", (_) => {
track_element.setAttribute("data-scroll", scroll_element.scrollTop); track_element.setAttribute("data-scroll", scroll_element.scrollTop);
for (const goal of goals) { for (const goal of goals) {
@ -635,7 +635,6 @@ media_theme_pref();
return; return;
} }
// biome-ignore lint/style/noParameterAssign: no it isn't
page += 1; page += 1;
await load_partial(); await load_partial();
}) })
@ -837,7 +836,6 @@ media_theme_pref();
}, time_until_remove * 1000); }, time_until_remove * 1000);
const count_interval = setInterval(() => { const count_interval = setInterval(() => {
// biome-ignore lint/style/noParameterAssign: no it isn't
time_until_remove -= 1; time_until_remove -= 1;
timer.innerText = time_until_remove; timer.innerText = time_until_remove;
}, 1000); }, 1000);
@ -1195,6 +1193,7 @@ ${option.input_element_type === "textarea" ? `${option.value}</textarea>` : ""}
self.IO_DATA_SEEN_IDS = []; self.IO_DATA_SEEN_IDS = [];
self.IO_DATA_WAITING = false; self.IO_DATA_WAITING = false;
self.IO_HAS_LOADED_AT_LEAST_ONCE = false; self.IO_HAS_LOADED_AT_LEAST_ONCE = false;
self.IO_DATA_DISCONNECTED = false;
if (!paginated_mode) { if (!paginated_mode) {
self.IO_DATA_OBSERVER.observe(self.IO_DATA_MARKER); self.IO_DATA_OBSERVER.observe(self.IO_DATA_MARKER);
@ -1207,7 +1206,10 @@ ${option.input_element_type === "textarea" ? `${option.value}</textarea>` : ""}
setTimeout(() => { setTimeout(() => {
if (!self.IO_HAS_LOADED_AT_LEAST_ONCE) { if (!self.IO_HAS_LOADED_AT_LEAST_ONCE) {
self.io_load_data(); // reload
Turbo.visit(window.location.href);
self.IO_DATA_OBSERVER.disconnect();
console.log("timeline load fail :(");
} }
}, 1500); }, 1500);
@ -1243,12 +1245,17 @@ ${option.input_element_type === "textarea" ? `${option.value}</textarea>` : ""}
loading_skel.remove(); loading_skel.remove();
} }
if (self.IO_DATA_DISCONNECTED) {
return;
}
if ( if (
text.includes(`!<!-- observer_disconnect_${window.BUILD_CODE} -->`) text.includes(`!<!-- observer_disconnect_${window.BUILD_CODE} -->`)
) { ) {
console.log("io_data_end; disconnect"); console.log("io_data_end; disconnect");
self.IO_DATA_OBSERVER.disconnect(); self.IO_DATA_OBSERVER.disconnect();
self.IO_DATA_ELEMENT.innerHTML += text; self.IO_DATA_ELEMENT.innerHTML += text;
self.IO_DATA_DISCONNECTED = true;
return; return;
} }