mirror of
https://github.com/calibrain/shelfmark.git
synced 2026-09-24 22:05:20 +01:00
fix: clear checkboxes on new search query (#66)
This PR addresses an issue where the "download selected" functionality behaves unexpectedly. If a user makes a selection of books to download, performs a new search without clearing the previous selection, and selects new books, clicking "download selected" would still include the books from the prior selection. This causes the "download selected" button to fail, as the books from the previous selection are no longer available. A potential enhancement could allow users to select books across multiple searches and download them collectively. This could be achieved by creating a dedicated section in the UI to track and display the currently selected books. This feature might go well with a broader UI overhaul, as has been suggested in some issues - maybe after your CF bypass rewrite? Co-authored-by: CaliBrain <calibrain@l4n.xyz>
This commit is contained in:
co-authored by
CaliBrain
parent
7f56c6b832
commit
aab3d7269a
+6
-2
@@ -221,7 +221,11 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
utils.fetchJson(`${API_ENDPOINTS.download}?id=${encodeURIComponent(bookId)}`)
|
||||
);
|
||||
|
||||
// Uncheck all selected checkboxes
|
||||
this.clearAllCheckboxes();
|
||||
modal.close();
|
||||
},
|
||||
|
||||
clearAllCheckboxes() {
|
||||
selectedBooks.forEach((bookId) => {
|
||||
const checkbox = document.getElementById(`book-${bookId}`);
|
||||
if (checkbox) checkbox.checked = false;
|
||||
@@ -232,13 +236,13 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
selectedBooks.clear();
|
||||
utils.updateDownloadSelectedButton();
|
||||
modal.close();
|
||||
}
|
||||
};
|
||||
|
||||
// Search Functions
|
||||
const search = {
|
||||
async performSearch(query) {
|
||||
utils.clearAllCheckboxes();
|
||||
if (STATE.isSearching) return;
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user