app/javascript/blacklight/checkbox_submit.js in blacklight-8.3.0 vs app/javascript/blacklight/checkbox_submit.js in blacklight-8.4.0

- old
+ new

@@ -35,11 +35,11 @@ return Promise.reject('response was not ok') }).then((json) => { this.labelTarget.removeAttribute('disabled') this.checkboxTarget.removeAttribute('disabled') this.updateStateFor(!this.checked) - document.querySelector('[data-role=bookmark-counter]').innerHTML = json.bookmarks.count + if (this.bookmarkCounter()) this.bookmarkCounter().innerHTML = json.bookmarks.count }).catch((error) => { this.handleError(error) }) } @@ -59,9 +59,13 @@ return this.form.querySelector('[data-checkboxsubmit-target="checkbox"]') } get spanTarget() { return this.form.querySelector('[data-checkboxsubmit-target="span"]') + } + + bookmarkCounter() { + return document.querySelector('[data-role="bookmark-counter"]') } handleError() { alert("Unable to save the bookmark at this time.") }