diff --git a/src/addons/progress/AddonRun.svelte b/src/addons/progress/AddonRun.svelte index a0e5e9af6..ed9477c6d 100644 --- a/src/addons/progress/AddonRun.svelte +++ b/src/addons/progress/AddonRun.svelte @@ -57,7 +57,7 @@ const resp = await fetch(endpoint, options); if (!resp.ok) { - throw new Error(resp.statusText); + throw new Error(`Error updating add-on run: ${resp.statusText}`); } // delete returns an empty response @@ -220,7 +220,9 @@ {#if run.message || run.file_url}
diff --git a/src/addons/progress/AddonStatus.svelte b/src/addons/progress/AddonStatus.svelte index 880980689..56e2659f0 100644 --- a/src/addons/progress/AddonStatus.svelte +++ b/src/addons/progress/AddonStatus.svelte @@ -22,7 +22,10 @@ const resp = await fetch(endpoint, options); if (!resp.ok) { - throw new Error(resp.statusText); + // just bail on errors and try again next cycle + return console.error( + `Failed to load add-on run status: ${resp.statusText}`, + ); } const { results } = await resp.json(); diff --git a/src/manager/documents.js b/src/manager/documents.js index f00063638..14b7c86f9 100644 --- a/src/manager/documents.js +++ b/src/manager/documents.js @@ -99,6 +99,7 @@ export const documents = new Svue({ return allDocuments; }, pendingExisting(docsById, pending) { + if (!pending) return []; return pending.filter((x) => { const id = x.doc_id; return docsById[id] != null; diff --git a/src/pages/home/Home.svelte b/src/pages/home/Home.svelte index a1beb5265..23363c065 100644 --- a/src/pages/home/Home.svelte +++ b/src/pages/home/Home.svelte @@ -30,7 +30,7 @@ const resp = await fetch(endpoint); if (!resp.ok) { - throw new Error(resp.statusText); + throw new Error(`Error fetching flat page: ${resp.statusText}`); } return resp.json(); diff --git a/src/util/visibility.js b/src/util/visibility.js index 58e5ff9d1..c3a19b0e8 100644 --- a/src/util/visibility.js +++ b/src/util/visibility.js @@ -1,6 +1,9 @@ // Adapted from https://svelte.dev/repl/ead0f1fcd2d4402bbbd64eca1d665341?version=3.14.1 export function showIfFullyVisible(el) { + // for very old browsers we don't support, bail + if (typeof window.IntersectionObserver === "undefined") return; + const setVisible = (visibility) => { el.style.visibility = visibility ? "visible" : "hidden"; }; diff --git a/src/viewer/document.js b/src/viewer/document.js index 2a4543cf9..b2a569966 100644 --- a/src/viewer/document.js +++ b/src/viewer/document.js @@ -227,7 +227,8 @@ class Doc extends Svue { if (this.scrollzoom == null) return resolve(); const scrollTop = - (this.scrollzoom.components[pageNumber].y - this.layout.pageGap / 4) * + (this.scrollzoom.components[pageNumber]?.y - + this.layout.pageGap / 4) * this.scrollzoom.transform.matrix[0]; if (this.scrollzoom.element != null) { this.scrollzoom.scrollTo(scrollTop);