Skip to content

Commit

Permalink
Merge pull request #339 from MuckRock/playwright-tests
Browse files Browse the repository at this point in the history
Handle a frequent typeerror when pending is undefined
  • Loading branch information
eyeseast authored Nov 14, 2023
2 parents 6a12597 + 58ec286 commit 1c53da2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/manager/documents.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,15 @@ export const documents = new Svue({
return getDocumentsByCondition((doc) => doc.readable, documents);
},
numProcessing(pending) {
return pending.length;
return (pending && pending.length) || 0;
},
rawDoneProcessing(numProcessing) {
// Wait a second before modulating value
return numProcessing == 0;
},

processingProgress(pending) {
if (pending.length == 0) return 1;
if (!pending || pending.length == 0) return 1;

// Operate on documents with non-null progresses
let totalPages = 0;
Expand Down Expand Up @@ -558,7 +558,7 @@ async function updatePending() {
if (documents.staticMode) return;

const pending = await wrapSeparate(null, layout, () => getPendingProgress());
for (let i = 0; i < pending.length; i++) {
for (let i = 0; i < (pending || []).length; i++) {
const pendingDoc = pending[i];
const existingDoc = documents.pendingMap[pendingDoc.doc_id];
if (existingDoc != null) {
Expand Down

0 comments on commit 1c53da2

Please sign in to comment.