Skip to content

Commit f58b067

Browse files
authored
Merge pull request #383 from freelawproject/fix-observer-for-download-page
fix(appellate): Adds logic to check for 'selectedDocuments' key
2 parents a63d41b + 33be43e commit f58b067

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/appellate/appellate.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -526,9 +526,15 @@ AppellateDelegate.prototype.handleAcmsDownloadPage = async function () {
526526
.toLowerCase()
527527
.includes('accept charges and retrieve');
528528

529-
let hasOneDocument = JSON.parse(
530-
sessionStorage.selectedDocuments
531-
).length == 1;
529+
// The `selectedDocuments` key in sessionStorage is only available when
530+
// the download page is loaded from an attachment page. It is not
531+
// available when loaded from a case summary entry. This check ensures
532+
// the extension can handle both scenarios gracefully.
533+
let hasOneDocument = true;
534+
if (sessionStorage.getItem('selectedDocuments')) {
535+
hasOneDocument =
536+
JSON.parse(sessionStorage.selectedDocuments).length == 1;
537+
}
532538

533539
if (
534540
n.localName === 'div' &&

0 commit comments

Comments
 (0)